Connecting Tech Pros Worldwide Forums | Help | Site Map

checkbox help

dot dot is offline
Newbie
 
Join Date: Jan 2007
Posts: 1
#1: Jan 16 '07
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 :
Expand|Select|Wrap|Line Numbers
  1. if(isset($form_input['name']) && !empty($form_input['name']))
  2. {
  3. if(preg_match("`[\r\n]`",$form_input['name'])){$errors[] = "You have submitted an invalid new line character";}
  4. if(preg_match("/[^a-z' -]/i",stripslashes($form_input['name']))){$errors[] = "You have submitted an invalid character in the name field";}
  5. }
  6.  
I need to make people choose many things and submit it

Please help..

thank you

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jan 16 '07

re: checkbox help


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.
Reply