Formularvariabeln im Browseradresszeile sichtbar

fredolin

Erfahrenes Mitglied
Hallo PHP Gemeinde,

ich arbeite an einem Formular, was über eine Webseite abgeschickt werden soll. Das Formular steht und ich habe eine Fehlerüberprüfung dazu geschrieben. Nun ist das So, wenn ich auf den Button klicke dann sehe ich alle Variablen, die ich im Formular erfasse oben in der Adressezeile vom Browser.

Das Formular wird per POST versendet...

Das finde ich komisch aber finde den Fehler nicht.

Hier mal mein Code

Formular
PHP:
<form action="?act=job" methode="post" enctype="multipart/form-data" autocomplete="off">
                <div class="col-50">
                    <div class="col-60">  
                        <div class="form-group">
                            <?php 
                                if(isset($error['anrede'])){
                                    echo '<lable class="form-lable-error" for="anrede">Anrede</lable>';
                                } else {
                                    echo '<lable for="anrede">Anrede</lable>';
                                }
                            ?>
                            <select class="" name="anrede">
                                <option>----</option>
                                <option value="Herr">Herr</option>
                                <option value="Frau">Frau</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <?php 
                                if(isset($error['name'])){
                                    echo '<lable class="form-lable-error" for="name">Nachname</lable>';
                                } else {
                                    echo '<lable for="name">Nachname</lable>';
                                }
                            ?>
                           
                            <input type="text" name="name" class="form-control" id="name" placeholder="Nachname">
                        </div>
                        <div class="form-group">
                            <?php 
                                if(isset($error[''])){
                                    echo '<lable class="form-lable-error" for="firstname">Vorname</lable>';
                                } else {
                                    echo '<lable for="firstname">Vorname</lable>';
                                }
                            ?>
                           
                            <input type="text" name="firstname" class="form-control" id="firstname" placeholder="Vorname">
                        </div>
                        <div class="form-group">
                            <?php 
                                if(isset($error['']) && isset($error['']) && isset($error[''])){
                                    echo '<lable class="form-lable-error" for="tag">Geburtsdatum</lable>';
                                } else {
                                    echo '<lable for="tag">Geburtsdatum</lable>';
                                }
                            ?>
                            <br /><br />
                            <input type="text" name="tag" class="form-control" id="tag" placeholder="Tag" maxlength="2"style="width:40px;float:left;">  
                            <input type="text" name="monat" class="form-control" id="monat" placeholder="Monat" maxlength="2"style="width:40px;float:left;">  
                            <input type="text" name="jahr" class="form-control" id="jahr" placeholder="Jahr" maxlength="4" style="width:65px;">
                           
                        </div>
                        <div class="clear"></div>
                        <div class="form-group">
                            <?php 
                                if(isset($error[''])){
                                    echo '<lable class="form-lable-error" for="email">E-Mail</lable>';
                                } else {
                                    echo '<lable for="email">E-Mail</lable>';
                                }
                            ?>
                           
                            <input type="email" name="email" class="form-control" id="email" placeholder="E-Mail Adresse">
                        </div>
                        <div class="form-group">
                        <?php 
                                if(isset($error[''])){
                                    echo '<lable class="form-lable-error" for="phone">Telefon</lable>';
                                } else {
                                    echo '<lable for="phone">Telefon</lable>';
                                }
                            ?>
                           
                            <input type="phone" name="phone" class="form-control" id="phone" placeholder="Telefon">
                        </div>
                    </div>
                </div>
                <div class="col-50">
                    <div class="col-60">
                        <div class="form-group">
                            <lable for="csv">Ihr Lebenslauf</lable>
                            <input type="file" name="csv" class="form-control" id="csv" palceholder="Ihren Lebenslauf hochladen">
                        </div>
                        <div class="form-group">
                            <lable for="photo">Ihr Passphoto</lable>
                            <input type="file" name="photo" class="form-control" id="photo" palceholder="Ein Photo hochladen">
                        </div>
                        <div class="form-group">
                            <lable for="smallmessages">Kurze Nachricht</lable>
                            <textarea id="smallmessages" class="form-control" rows="3"></textarea>
                        </div>
                        <div class="form-group">
                            <?php 
                                if(isset($error['gleichung'])){
                                    echo '<lable class="form-lable-error" for="gleichung">Spamschutz*</lable>';
                                } else {
                                    echo '<lable for="spam">Spamschutz*</lable>';
                                }
                            ?>
                           
                            <p>
                                Bitte lösen Sie die Gleichung: <span class="brepack-h3"><?php echo $gl1." ".$op." ".$gl2; ?></span>
                                <input type="text" class="form-control" name="gleichung" size="4" />
                            </p>
                       </div>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="col-70">&nbsp;
                    <input type="hidden" name="action" value="bewerbungsmail">
                    <input type="hidden" name="bewerben">
                    <input type="hidden" name="glloesung" value="<?php echo $loesungmd5; ?>" />
                </div>
                <div class="col-30">
                    <button type="submit" name="senden">Sich Bewerben</button>
                </div>
            </form>

Hier der Code, der über eine function in die Seite eingebunden wird.

PHP:
function bewerbmailsenden() {
   
   
   
   
    $ready = false;
    $error = array();
   
    $anrede;
    $name;
    $firstname;
    $tag;
    $monat;
    $jahr;
    $phone;
    $email;
   
    $gleichung;
   
    $attachments['name'];
    $attachments['size'];
    $attachments['type'];
    $attachments['data'];
           
   
        if($_POST['submit'] == 'senden'){
        echo '<pre>';
        print_r($_POST);
        echo '</pre>';
            if(empty($_POST['anrede'])) {
                $ready = true;
                $error['anrede'] = 'Anrde fehlt';
            }
            if(empty($_POST['name'])){
                $ready = true;
                $error['name'] = 'Nachname fehlt';
            }
            if(empty($_POST['firstname'])){
                $ready = true;
                $error['firstname'] = 'Vorname fehlt';
            }
           
            if(preg_match("~[^-a-zA-Z/()+]~", $_POST['tag']) || empty($_POST['tag'])){
                $ready = true;
                $error['tag'] = 'Bitte nur Zahlen eingeben';
            }
            if(preg_match("~[^-a-zA-Z/()+]~", $_POST['monat']) || empty($_POST['monat'])){
                $ready = true;
                $error['monat'] = 'Bitte nur Zahlen eingeben';
            }
            if(preg_match("~[^-a-zA-Z/()+]~", $_POST['jahr']) || empty($_POST['jahr'])){
                $ready = true;
                $error['jahr'] = 'Bitte nur Zahlen eingeben';
            }
           
            if(preg_match("~[^-a-zA-Z/()+]~", $_POST['phone']) || empty($_POST['phone'])){
                $ready = true;
                $error['phone'] = 'Telefon-Nr. angeben';
            }
           
            if(!preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-z]{2,6}$/i", $_POST['email'])){
                $ready = true;
                $error['email'] = 'E-Mail fehlt';
            }
           
            if(empty($_POST['gleichung'])){
                $ready = true;
                $error['gleichung'] = 'Bitte Rechenaufgabe lösen';
            }   
        }
       
        if(isset($_POST['submit']) && $_POST['submit'] == 'senden' && $ready) {
           
            $domain = $_SERVER['HTTP_HOST'];
            $mailaddy = 'xxxx@aaaa.hh;
            $datum = date("d.m.Y");
            $sendtime = date("H:m:s");
            $subject = 'testmail';

// E-Mailinhalt was versendet wird //
            $mailbody = '
                <table cellpadding="0" cellspacing="0" width="680" border="0" align="center">
                            <tr>
                                <td colspan="4" align="left"><h2>'.$_POST['formheadline'].'</h2></td>
                            </tr>
                            <tr>
                                <td align="left">Domain:</td>
                                <td align="left" colspan="3">'.$domain.'</td>
                            </tr>
                            <tr>
                                <td align="left">Sendedatum:</td>
                                <td align="left">'.$datum.'</td>
                                <td align="left">Senduhrzeit:</td>
                                <td align="left">'.$sendtime.'</td>
                            </tr>
                            <tr>
                                <td colspan="4"><hr></td>
                            </tr>
                            <tr>
                                <td colspan="4"><h3>Daten die an uns &uuml;bermittelt wurden</h3></td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">ANrde:</td>
                                <td align="left" colspan="3">'.$_POST['anrede'].'</td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">Vorname:</td>
                                <td align="left" colspan="3">'.$_POST['firstname'].'</td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">Nachname:</td>
                                <td align="left" colspan="3">'.$_POST['name'].'</td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">Geburtsdatum:</td>
                                <td align="left" colspan="3">'.$_POST['tag'].' . '.$_POST['monat'].' . '.$_POST['jahr'].'</td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">E-Mail-Adresse:</td>
                                <td align="left" colspan="3">'.$_POST['email'].'</td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">Telefon:</td>
                                <td align="left" colspan="3">'.$_POST['phone'].'</td>
                            </tr>
                            <tr>
                                <td colspan="4" height="12">&nbsp;</td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">Nachricht:</td>
                                <td align="left" colspan="3">'.$_POST['smallmessages'].'</td>
                            </tr>
                            <tr>
                                <td colspan="4" height="12">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="6"><hr></td>
                            </tr>
                        </table>';
                       
                $mime_boundary = "-----=" . md5(uniqid(mt_rand(), 1));
               
                $header  = "From:" . htmlspecialchars($_POST['firstname']). "  <"   . htmlspecialchars($_POST['email']) .   ">\r\n";
                $header    .= "MIME-Version: 1.0\r\n";
                $header    .= "Content-Type: multipart/mixed;\r\n";
                  $header    .= " boundary=\"".$mime_boundary."\"\r\n";
           
                $content = "This is a multi-part message in MIME format.\r\n\r\n";
                  $content.= "--".$mime_boundary."\r\n";
                  $content.= "Content-Type: text/html charset=\"iso-8859-1\"\r\n";
                  $content.= "Content-Transfer-Encoding: 8bit\r\n\r\n";
                  $content.= $mailbody."\r\n";
               
                //$anhang ist ein Mehrdimensionals Array
               //$anhang enthält mehrere Dateien
              if(is_array($attachments) AND is_array(current($attachments)))
                 {
                 foreach($attachments AS $dat)
                    {
                    $data = chunk_split(base64_encode($dat['data']));
                    $content.= "--".$mime_boundary."\r\n";
                    $content.= "Content-Disposition: attachment;\r\n";
                    $content.= "\tfilename=\"".$dat['name']."\";\r\n";
                    $content.= "Content-Length: .".$dat['size'].";\r\n";
                    $content.= "Content-Type: ".$dat['type']."; name=\"".$dat['name']."\"\r\n";
                    $content.= "Content-Transfer-Encoding: base64\r\n\r\n";
                    $content.= $data."\r\n";
                    }
                 $content .= "--".$mime_boundary."--"; 
                 }
              else //Nur 1 Datei als Anhang
                 {
                 $data = chunk_split(base64_encode($attachments['data']));
                 $content.= "--".$mime_boundary."\r\n";
                 $content.= "Content-Disposition: attachment;\r\n";
                 $content.= "\tfilename=\"".$attachments['name']."\";\r\n";
                 $content.= "Content-Length: .".$attachments['size'].";\r\n";
                 $content.= "Content-Type: ".$attachments['type']."; name=\"".$attachments['name']."\"\r\n";
                 $content.= "Content-Transfer-Encoding: base64\r\n\r\n";
                 $content.= $data."\r\n";
                 } 
                 
              $send = mail($mailaddy, $subject, $content, $header);
            if($send){
                echo '<strong>Ok, your Mail was going out...:-)</strong>';
                echo '<script language="JavaScript" type="text/javascript">self.location.href="?act=startseite"</script>';
                //exit;
            } else {
                echo '<strong>Bad..:-(.. Email was not send</strong>';
            }
           
        } elseif(empty($_POST['action']) && empty($_POST['gleichung'])) {
            $error['mailerror'] = '
            <p style="width:100%;border:2px solid rgba(255, 0, 0, .5);text-align:center;font-size:1.17em;display:block;">
                Sie haben das Formular nicht ganz ausgefühlt oder haben die Rechenaufgabe verkehrt gelöst.<a href="?act=job">Zurück</a>
            </p>';
        }
 
methode="post" muss method="post" heißen (Englisch, ohne e). Den Rest habe ich mir jetzt erst mal nicht angesehen.
 

Neue Beiträge

Zurück