Forms and Checkbox Validation

Discussion in 'HTML & Website Design' started by lithman, Jan 31, 2008.

  1. #1
    I currently have a form with a checkbox on it. Right now the person can still submit their info whether the checkbox is checked or not. I want to set it so that if the person doesn't check the checkbox, then the form won't submit.

    How do I do this? I'm hoping for something simple like just adding a line of code to the form.

    Here is my current form:

    
    
    <form action="xxxx.asp" method="post" name="xxx" id="xxx">
    								<fieldset>
    								
    <p align="center">
    Name: <input type="text" name="name" size="20" maxlength="50"></p>
    <p align="center">
    Email: <input type="text" name="email" size="20" maxlength="50"></p>
    <p align="center">
    Zip: <input type="text" name="zip" size="5" maxlength="10"></p>
    <p align="center">
    <input type="checkbox" name="Rules" checked="checked"><small>By checking this box, you agree to the contest rules and to receive periodic offers and news from us.</small><br>
    <input type="hidden" name="return_url" id="return_url" value="http://www.mydomain.com/submit.php?submitted=true">
    <input type="hidden" name="tid" id="tid" value="33">
    <input type="submit" name="Submit" value="Submit"><br>
    </p>
    </fieldset>
    </form>	
    
    
    Code (markup):

     
    lithman, Jan 31, 2008 IP
  2. mutley

    mutley Peon

    Messages:
    356
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    are you going to be using php to send the information or ASP

    i would say php is best :p you want the user to have to click a box before it sends it of to the post script yes
     
    mutley, Jan 31, 2008 IP