form validation

Member_2_5230414
Member_2_5230414 used Ask the Experts™
on
What would be the best way to validate the below form.

I would like it so the error message is dispalayed between the <p class="alert"><p>

The issue is if the validation is correct the form needs to be submitted to globmail.html
<p class="alert">This is an error</p>
<form action="<?=$conf['site_url']?>globmail.html" method="post" class="basic2" id="enquiry">
  <fieldset>
<ul>

<li>
    <label>Name:</label>
    <input type="text" name="name" />
</li>
<li>
    <label>Email: </label>
    <input type="email" name="email" />
</li>
<li>
    <label>Nature of Enquiry: </label>
    <select name="nature_of_enquiry">
    <option> -- Please Select -- </option>
    	<option value="Public Relations">Public Relations</option>
		<option value="Press / Media">Press / Media</option>
		<option value="General Enquiries">General Enquiries</option>
		<option value="Technical problem">Technical problem</option>
		<option value="Need help using the site">Need help using the site</option>
		<option value="Suggestions">Suggestions</option>
		<option value="Advertisting Enquiries">Advertisting Enquiries</option>
		<option value="Invester Enquiries">Invester Enquiries</option>
		<option value="Other">Other</option>
    </select>
</li>
<li>
    <label for="message">Message:</label>

    <textarea name="message" id="message" cols="25" rows="5"></textarea>
</li>
</ul>
  </fieldset>
  <fieldset>
<ul>
<li class="validation group">
    <p>For validation, please answer the following simple sum:</p>

    <label><?=$sum1?> + <?=$sum2?> = </label>

    <input type="text" name="sumvalue" />
</li>
<li>
    <input type="submit" value="Send Enquiry" class="send" />
</li>
</ul>
  </fieldset>
  <fieldset class="hidden">
    <input type="hidden" name="sum1" value="<?=$sum1?>" />
    <input type="hidden" name="sum2" value="<?=$sum2?>" />

    <input type="hidden" name="subject" id="subject" value="<?=$conf['site_name']?> Enquiry Form" />
    <input type="hidden" name="required" id="required" value="" />
	<!-- REMEMBER TO ADD THE EMAIL ADDRESS TO THE ALLOWED LIST -->
  </fieldset>
</form>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You could try jquery validation, http://jquery.bassistance.de/validate/demo/

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial