my first post so be gentle... I have a PHP contact form where on a php page (contact.php)
<form id="contact" method="post" action="send.php">
On clicking the send button the data goes to the send.php script to be validated. If passes validation, the user views a sent.html page where the message "Your Message Has Been Sent - Thank You" is displayed
$message = "Your Message Has Been Sent - Thank You";
include "sent.html";
However if validation fails, for example, if a field is left blank the validation fails the send & the $message is displayed on the within the form, back on the on the contact.php...
if ((!$fname) OR (!$lname) OR (!$email) OR (!$enquiry))
{
$message = "ERROR: ALL FEILDS MARKED * MUST BE COMPLETED";
include "contact.php";
exit();
The message is displayed on the contact.php page form using:
<?php
print "$message";
?>
This is operational, but the form is halfway down the page and the user has to scroll down to view the failed sending of the message, which could be missed, and views poorly... How can I ensure that on failed validation the contact.php page is displayed with the form at the top of the page? Can I apply an anchor, or a method or retuing to the form id? Thanks in advance.
