php coding for checkboxes

Reply

Join Date: Aug 2005
Posts: 9
Reputation: quansah is an unknown quantity at this point 
Solved Threads: 0
quansah quansah is offline Offline
Newbie Poster

php coding for checkboxes

 
0
  #1
Aug 27th, 2005
i have a form with checkboxes and i was wondering how i could write the php code so that the choices you check can come into my email. here is the html coding for the form:

<form action="<?php echo $me;?>" method="post" name="form1" id="form1">
<p>Name :
<input type="text" name="textfield">
</p>
<p>Course:
<input type="text" name="textfield">
</p>
<p>Tel No:
<input type="text" name="textfield">
</p>
<p>
<input type="checkbox" name="checkbox" value="Judicial Committee">
Judicial Committee<br>
<input type="checkbox" name="checkbox" value="Welfare Committee">
Welfare Committee<br>
<input type="checkbox" name="checkbox" value="External Affairs Committee">
External Affairs Committee<br>
<input type="checkbox" name="checkbox" value="Transport Committee">
Transport Committee<br>
<input type="checkbox" name="checkbox" value="Disciplinary Committee">
Disciplinary Committee<br>
<input type="checkbox" name="checkbox" value="Entertainment Committee">
Entertainment Committee<br>
<input type="checkbox" name="checkbox" value="Publication Committee">
Publication and Information </p>
<p align="center">
<input type="submit" name="Submit" value="Join Now">
</p>
<p align="left"> <br>
</p>
</form>
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 294
Reputation: zippee is an unknown quantity at this point 
Solved Threads: 6
zippee's Avatar
zippee zippee is offline Offline
Posting Whiz in Training

Re: php coding for checkboxes

 
0
  #2
Aug 27th, 2005
You should change the checkbox names, they are all the same now (each checkbox name has to be unique). PHP code to identify whether a checkbox is checked, use:
[php]if(isset($_POST['checkbox_name'])) echo 'checked';[/php]
Ecommerce-Web-Store.com Building Your e-Business.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 1
Reputation: Deadly_Killer is an unknown quantity at this point 
Solved Threads: 0
Deadly_Killer Deadly_Killer is offline Offline
Newbie Poster

Re: php coding for checkboxes

 
0
  #3
Jun 16th, 2006
<input name="cd0" type="checkbox" checked="checked">
<?
if(isset($_POST['cd0'])){ echo 'checked';}
?>

dont works, can u help me?
Last edited by Deadly_Killer; Jun 16th, 2006 at 2:57 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 9
Reputation: JNathanson is an unknown quantity at this point 
Solved Threads: 1
JNathanson JNathanson is offline Offline
Newbie Poster

Re: php coding for checkboxes

 
0
  #4
Jun 17th, 2006
Originally Posted by Deadly_Killer
<input name="cd0" type="checkbox" checked="checked">
<?
if(isset($_POST['cd0'])){ echo 'checked';}
?>

dont works, can u help me?
You need to post the form.


myform.php
[PHP]
<form action="check.php" method="POST" name="myform">
<input name="cd0" type="checkbox" checked="checked">
</form>[/PHP]

check.php
[PHP]
<?PHP
if(isset($_POST['cd0'])){ echo 'checked';}
?>
[/PHP]
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC