<p>It's not a big thing, but I'd probably do my redirect with a header tag rather than a meta-redirect, swapping your print "<meta" with header("Location: Success.html");</p>
<p>Also, if it were me, for brevity, I'd write your body line as follows:</p>
<p>$body="Name: $name\nTel: $tel\n";</p>
<p>This cuts down on the amount of adding strings together, which in the long term may or not make your code more understandable.</p>
<p>Also, why did you comment out your validation code? If you have something like the below, that'd do your validation as well :)</p>
<p>if($isValid==false) {header("Location: fail.html");} else {<br>
//put your mail sending code in here<br>
header("Location: success.html");<br>
}</p>
<p>-- <br>
Jon ""The Nice Guy"" Spriggs LPIC-1 Certified <br>
This message was sent from my mobile device. Please excuse any top posting and typos that may occur as a result.</p>
<p><blockquote type="cite">On Oct 13, 2009 4:43 PM, <<a href="mailto:Idvaughan@aol.com" target="_blank">Idvaughan@aol.com</a>> wrote:<br><br>
<div style="font-size:10pt;color:#000000;font-family:Arial"><font face="Arial" color="#000000" size="2">
<div>Hi</div>
<div> </div>
<div>I'm just starting out using PHP and have created the following contact us
to email web form. I am looking for some advice and best practice
please</div>
<div> </div>
<div>Does the form processing script look ok and secure?</div>
<div> </div>
<div>For example I would like to include server side validation so if a web user
has not completed certain fields then it would display on the form page that
they have not filled in the 'Name' field or entered a correct email address for
example. If so what is the best way of achieving the above with my script
below?</div>
<div> </div>
<div>Also I would welcome any other best practice or advice regarding the
form.</div>
<div> </div>
<div>Many Thanks,</div>
<div> </div>
<div> </div>
<div><?php</div>
<div> </div>
<div>// get posted data into local variables<br>$EmailFrom = "<a href="mailto:idvaughan@aol.com" target="_blank">idvaughan@aol.com</a>";<br>$EmailTo = "<a href="mailto:idvaughan@aol.com" target="_blank">idvaughan@aol.com</a>";<br>
$Subject =
"Enquiry";<br>$Name = Trim(stripslashes($_POST['Name'])); <br>$Tel =
Trim(stripslashes($_POST['Tel'])); <br>$email =
Trim(stripslashes($_POST['email'])); <br>$message =
Trim(stripslashes($_POST['message'])); </div>
<div> </div>
<div>// validation<br>//$validationOK=true;<br>//if (Trim($Name)=="")
$validationOK=false;<br>//if (Trim($email)=="") $validationOK=false;<br>//if
(Trim($message)=="") $validationOK=false;<br>//if (!$validationOK) {<br>//
print "<meta http-equiv=\"refresh\"
content=\"0;URL=contactus1.html\">";<br>// exit;<br>//}</div>
<div> </div>
<div>// prepare email body text<br>$Body = "";<br>$Body .= "Name: ";<br>$Body .=
$Name;<br>$Body .= "\n";<br>$Body .= "Tel: ";<br>$Body .= $Tel;<br>$Body .=
"\n";<br>$Body .= "email: ";<br>$Body .= $email;<br>$Body .= "\n";<br>$Body .=
"message: ";<br>$Body .= $message;<br>$Body .= "\n";</div>
<div> </div>
<div>// send email <br>$success = mail($EmailTo, $Subject, $Body, "From:
<$EmailFrom>");</div>
<div> </div>
<div>// redirect to success page <br>if ($success){<br> print "<meta
http-equiv=\"refresh\"
content=\"0;URL=emailok.html\">";<br>}<br>else{<br> print "<meta
http-equiv=\"refresh\"
content=\"0;URL=contactus1.html\">";<br>}<br>?></div>
<div> </div>
<div> </div></font></div>
<br>_______________________________________________<br>
Phpwm mailing list<br>
Website : <a href="http://www.phpwm.org" target="_blank">http://www.phpwm.org</a><br>
Twitter : <a href="http://www.twitter.com/phpwm" target="_blank">http://www.twitter.com/phpwm</a><br>
Facebook: <a href="http://www.facebook.com/group.php?gid=2361609907" target="_blank">http://www.facebook.com/group.php?gid=2361609907</a><br>
<br>
Post to list: <a href="mailto:Phpwm@mailman.lug.org.uk" target="_blank">Phpwm@mailman.lug.org.uk</a><br>
Archive etc : <a href="https://mailman.lug.org.uk/mailman/listinfo/phpwm" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/phpwm</a><br></blockquote></p>