| | |
php coding for checkboxes
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2005
Posts: 9
Reputation:
Solved Threads: 0
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>
<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>
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]
[php]if(isset($_POST['checkbox_name'])) echo 'checked';[/php]
Ecommerce-Web-Store.com Building Your e-Business.
•
•
Join Date: May 2006
Posts: 9
Reputation:
Solved Threads: 1
•
•
•
•
Originally Posted by Deadly_Killer
<input name="cd0" type="checkbox" checked="checked">
<?
if(isset($_POST['cd0'])){ echo 'checked';}
?>
dont works, can u help me?
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]
![]() |
Similar Threads
- PhP Help - Coding (Web Development Job Offers)
- PhP Help - Coding (PHP)
- Accessing HTML checkboxes with php and javascript (PHP)
- PHP coder needed for online game (Web Development Job Offers)
- php coding (PHP)
Other Threads in the PHP Forum
- Previous Thread: yay
- Next Thread: IP-to-Country converter (php script)
| Thread Tools | Search this Thread |
apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl data database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip javascript joomla limit link links login mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion remote script search searchbox server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web website window.onbeforeunload=closeme; xml youtube





