checkbox help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dot
    New Member
    • Jan 2007
    • 1

    checkbox help

    Hello everyone

    I am a newbie and I got a script from http://formtoemail.com/FormToEmail.txt
    I managed to add more fields and they were sent via email, my problem is, I need to add checkboxes to the html file which I know how but I dont know what to write in the php script, the code for the form firlds is :
    Code:
    if(isset($form_input['name']) && !empty($form_input['name']))
    {
    if(preg_match("`[\r\n]`",$form_input['name'])){$errors[] = "You have submitted an invalid new line character";}
    if(preg_match("/[^a-z' -]/i",stripslashes($form_input['name']))){$errors[] = "You have submitted an invalid character in the name field";}
    }
    I need to make people choose many things and submit it

    Please help..

    thank you
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    The code you have posted is error-checking code, not code to display your form.

    If you want to display checkboxes use the following outside your PHP code
    [HTML]<input type="checkbox" name="somename" value="someval" ...>[/HTML]
    If you need PHP code to output the checkboxes, just use an echo and make sure you escape the strings with backslashes.

    Comment

    Working...