dgh1981 Posted October 27, 2009 Share Posted October 27, 2009 I am having problems with a form I have created and can't see what is wrong can anybody help?? The form is at www.unilinks.org.uk/contact.html Any help would be much appreciated. the engine code is below: <?php $EmailFrom = "Unilink Advice Form"; $EmailTo = "[email protected]"; $Subject = "Unilink Student Advice Form"; $familyname = Trim(stripslashes($_POST['familyname'])); $mrmrs = Trim(stripslashes($_POST['mrmrs'])); $firstnames = Trim(stripslashes($_POST['firstnames'])); $email = Trim(stripslashes($_POST['email'])); $repeatemail = Trim(stripslashes($_POST['repeatemail'])); $tel = Trim(stripslashes($_POST['tel'])); $address(stripslashes($_POST['address'])); $nationality(stripslashes($_POST['nationality'])); $dateofbirth(stripslashes($_POST['dateofbirth'])); $passport(stripslashes($_POST['passport'])); $whatcountry(stripslashes($_POST['whatcountry'])); $whatsubject(stripslashes($_POST['whatsubject'])); $qualifications(stripslashes($_POST['qualifications'])); $fluency(stripslashes($_POST['fluency'])); $funding(stripslashes($_POST['funding'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "familyame: "; $Body .= $familyname; $Body .= "\n"; $Body .= "mrmrs: "; $Body .= $mrmrs; $Body .= "\n"; $Body .= "firstnames: "; $Body .= $firstnames; $Body .= "\n"; $Body .= "email: "; $Body .= $email; $Body .= "\n"; $Body .= "repeatemail: "; $Body .= $repeatemail; $Body .= "\n"; $Body .= "tel: "; $Body .= $tel; $Body .= "\n"; $Body .= "address: "; $Body .= $address; $Body .= "\n"; $Body .= "nationality: "; $Body .= $nationality; $Body .= "\n"; $Body .= "dateofbirth: "; $Body .= $dateofbirth; $Body .= "\n"; $Body .= "passportnumber: "; $Body .= $passportnumber; $Body .= "\n"; $Body .= "whatcountry: "; $Body .= $whatcountry; $Body .= "\n"; $Body .= "whatsubject: "; $Body .= $whatsubject; $Body .= "\n"; $Body .= "qualifications: "; $Body .= $qualifications; $Body .= "\n"; $Body .= "fluency: "; $Body .= $fluency; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Link to comment https://forums.phpfreaks.com/topic/179177-solved-help-with-form-coding/ Share on other sites More sharing options...
trq Posted October 27, 2009 Share Posted October 27, 2009 I am having problems with a form I have created and can't see what is wrong can anybody help?? Not without you telling us what you expect to happen and what is actually happening. Link to comment https://forums.phpfreaks.com/topic/179177-solved-help-with-form-coding/#findComment-945321 Share on other sites More sharing options...
Bricktop Posted October 27, 2009 Share Posted October 27, 2009 Hi dgh1981, From line 12 onwards you're not using the = to define the variables (you're also omitting the trim function). Your code: $address(stripslashes($_POST['address'])); $nationality(stripslashes($_POST['nationality'])); $dateofbirth(stripslashes($_POST['dateofbirth'])); $passport(stripslashes($_POST['passport'])); $whatcountry(stripslashes($_POST['whatcountry'])); $whatsubject(stripslashes($_POST['whatsubject'])); $qualifications(stripslashes($_POST['qualifications'])); $fluency(stripslashes($_POST['fluency'])); $funding(stripslashes($_POST['funding'])); Should be: $address = trim(stripslashes($_POST['address'])); $nationality = trim(stripslashes($_POST['nationality'])); $dateofbirth = trim(stripslashes($_POST['dateofbirth'])); $passport = trim(stripslashes($_POST['passport'])); $whatcountry = trim(stripslashes($_POST['whatcountry'])); $whatsubject = trim(stripslashes($_POST['whatsubject'])); $qualifications = trim(stripslashes($_POST['qualifications'])); $fluency = trim(stripslashes($_POST['fluency'])); $funding = trim(stripslashes($_POST['funding'])); Hope this helps. Link to comment https://forums.phpfreaks.com/topic/179177-solved-help-with-form-coding/#findComment-945324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.