<p>It&#39;s not a big thing, but I&#39;d probably do my redirect with a header tag rather than a meta-redirect, swapping your print &quot;&lt;meta&quot; with header(&quot;Location: Success.html&quot;);</p>
<p>Also, if it were me, for brevity, I&#39;d write your body line as follows:</p>
<p>$body=&quot;Name: $name\nTel: $tel\n&quot;;</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&#39;d do your validation as well :)</p>
<p>if($isValid==false) {header(&quot;Location: fail.html&quot;);} else {<br>
//put your mail sending code in here<br>
header(&quot;Location: success.html&quot;);<br>
}</p>
<p>-- <br>
Jon &quot;&quot;The Nice Guy&quot;&quot; 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,  &lt;<a href="mailto:Idvaughan@aol.com" target="_blank">Idvaughan@aol.com</a>&gt; 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&#39;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 &#39;Name&#39; 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>&lt;?php</div>
<div> </div>
<div>// get posted data into local variables<br>$EmailFrom = &quot;<a href="mailto:idvaughan@aol.com" target="_blank">idvaughan@aol.com</a>&quot;;<br>$EmailTo = &quot;<a href="mailto:idvaughan@aol.com" target="_blank">idvaughan@aol.com</a>&quot;;<br>

$Subject = 
&quot;Enquiry&quot;;<br>$Name = Trim(stripslashes($_POST[&#39;Name&#39;])); <br>$Tel = 
Trim(stripslashes($_POST[&#39;Tel&#39;])); <br>$email = 
Trim(stripslashes($_POST[&#39;email&#39;])); <br>$message = 
Trim(stripslashes($_POST[&#39;message&#39;])); </div>
<div> </div>
<div>// validation<br>//$validationOK=true;<br>//if (Trim($Name)==&quot;&quot;) 
$validationOK=false;<br>//if (Trim($email)==&quot;&quot;) $validationOK=false;<br>//if 
(Trim($message)==&quot;&quot;) $validationOK=false;<br>//if (!$validationOK) {<br>//  
print &quot;&lt;meta http-equiv=\&quot;refresh\&quot; 
content=\&quot;0;URL=contactus1.html\&quot;&gt;&quot;;<br>//  exit;<br>//}</div>
<div> </div>
<div>// prepare email body text<br>$Body = &quot;&quot;;<br>$Body .= &quot;Name: &quot;;<br>$Body .= 
$Name;<br>$Body .= &quot;\n&quot;;<br>$Body .= &quot;Tel: &quot;;<br>$Body .= $Tel;<br>$Body .= 
&quot;\n&quot;;<br>$Body .= &quot;email: &quot;;<br>$Body .= $email;<br>$Body .= &quot;\n&quot;;<br>$Body .= 
&quot;message: &quot;;<br>$Body .= $message;<br>$Body .= &quot;\n&quot;;</div>
<div> </div>
<div>// send email <br>$success = mail($EmailTo, $Subject, $Body, &quot;From: 
&lt;$EmailFrom&gt;&quot;);</div>
<div> </div>
<div>// redirect to success page <br>if ($success){<br>  print &quot;&lt;meta 
http-equiv=\&quot;refresh\&quot; 
content=\&quot;0;URL=emailok.html\&quot;&gt;&quot;;<br>}<br>else{<br>  print &quot;&lt;meta 
http-equiv=\&quot;refresh\&quot; 
content=\&quot;0;URL=contactus1.html\&quot;&gt;&quot;;<br>}<br>?&gt;</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>