m4nu Posted June 5, 2007 Share Posted June 5, 2007 Hi all! i am having a little problem with my php form. I have been using it for years and it worked well until now. I checked and rechecked the code and i can t find any mistakes. But i am very limited in php knowlege. The problem is that when i click submit button on the form, the php page loads, and tells me that none of the text field have been filled. I have no idea how i can fix that. I ll appreciate a lot if you guys can help out. Cheers <form action="SendForm.php" method="post"/> <ul class ="form"> <li class="gris"><span>Vorname:</span> <input size="35" type="text" name="firstname"/></li> <li ><span>Nachname:</span> <input size="35" type="text" name="lastname"/></li> <li class="gris"><span>E-mail Adresse:</span> <input type="text" size="35" name="email" /></li> <li ><span>Land:</span> <input size="35" type="text" name="country"/></li> <li class="gris"><span>Nachricht:</span> <textarea rows="3" name="message"></textarea></li> <li ><input type="submit" value="senden" /> </li> </ul></form> <?php $MailTo = "m4nu@hotmail.fr"; $MailHeader = "From: SchoolWebSite"; //adresse email qui va figurer dans le champ "expéditeur" $Envoi = 1; //initialisation de la variable envoi à 1 if ($firstname == ""){ //nom du champ1 echo("<font face=verdana size=2>You haven't filed your \"Name\".</font><br>"); //message qui s'affiche si le visiteur n'a pas rempli ce champ $Envoi = 0; //si le champ1 n'a pas été rempli, la variable envoi prend la valeur de 0 } else { $MailBody = "Name : $firstname\n"; //si le champ1 contient de l'information, elle est stockée dans la variable MailBody } //// if ($lastname == ""){ echo("<font face=verdana size=2>You haven't filed your \"lastname\".</font><br>"); $Envoi = 0; } else { $MailBody .= "Lastname : $lastname\n"; } //// if ($email == ""){ echo("<font face=verdana size=2>You haven't filed your \"Email\"</font><br>"); $Envoi = 0; } else { $MailBody .= "Email : $email\n"; } //// if ($country == ""){ echo("<font face=verdana size=2> You haven't filed your \"Country\".</font><br>"); $Envoi = 0; } else { $MailBody .= "Country : $country\n"; } //////// if ($message == ""){ echo("<font face=verdana size=2>You haven't filed your \"Message\".</font><br>"); $Envoi = 0; } else { $MailBody .= "Contenu du message: $message\n"; }//// if ($Envoi == 0) echo("Connection lost while sending the form. Retry later or send us directly a mail to this adresse e_tch@hotmail.com<p> </p>"); if ($Envoi == 1) { //vérification que la variable envoi est bien à 1 $MailSubject = "From the website"; //texte qui va figurer dans le champ "sujet" du email mail($MailTo, $MailSubject, $MailBody, $MailHeader); //envoi du message echo("<p><font face=verdana size=2>Your message has been sended.<br> We ll reply as soon as possible</font>"); echo("<p> </p><p> </p><p align=\"center\"><a href=\"http://www.disc.com\"><strong>Retour</strong></a></p>"); //affichage d'un message de confirmation. } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54209-form-submition-problem/ Share on other sites More sharing options...
dough boy Posted June 5, 2007 Share Posted June 5, 2007 Did you change servers or anything and turn REGISTER_GLOBALS off? Try changing: if ($firstname == "") to if ($_POST['firstname'] == '') and then run it again and see if it still gives you an error on that field? Quote Link to comment https://forums.phpfreaks.com/topic/54209-form-submition-problem/#findComment-268021 Share on other sites More sharing options...
m4nu Posted June 5, 2007 Author Share Posted June 5, 2007 Well thanks a lot doughtboy.It s allmost working, the feilds validate corectly but it doesn t send me any email . Should i use the same syntax for the variable "Envoi" too? Quote Link to comment https://forums.phpfreaks.com/topic/54209-form-submition-problem/#findComment-268039 Share on other sites More sharing options...
m4nu Posted June 5, 2007 Author Share Posted June 5, 2007 I just realized i have let my email in the Php code and i can t edit the post anymore. would somebody please delete it. I don t want it to be grab by spambots. Quote Link to comment https://forums.phpfreaks.com/topic/54209-form-submition-problem/#findComment-268046 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.