Hi All,
i wonder if anyone can help me. I've got a form where you can enter your email address and a surname to search for, when clicking on the submit button the form is processed with a PHP page and sent via email.
What I want to do is check that the email address field in the form is filled in before being submitted.
The code for each is shown below:
The form:
<form method="post" action="contact5.php">
Email Address:<br />
<input name="email" type="text" class="style1"><br>
Surname To Search:<br>
<input name="q" type="text" class="style1"><br>
<input type="submit">
</form>
The processing php code:
<table width="640" cellpadding="0" cellspacing="0">
<tr>
<td id="header">Surname Search</td>
</tr>
<tr>
<td id="navigation" align="center"><?
$to = "admin@personally-yours.co.uk";
$subject = "Surname Search";
$email = $_REQUEST['email'];
$message = $_REQUEST['q'];
$body = "Hello, Im looking for the surname '$message'\n\nRegards\n\n $email";
$headers = "From: $email";
ini_set("sendmail_from", "admin@personally-yours.co.uk");
$sent = mail($to, $subject, $body, $headers);
if($sent)
{print "Thank You for your query. We will reply within 24 hours.";}
else
{print "We encountered an error sending your mail";}
?><br />
<br /><br /><br /><a href="javascript:history.back(-1);">Click here</a> to return to the previous page.
</td>
</tr>
</table>