| | |
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)
Views: 31641 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code countingeverycharactersfromastring cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match menu methods mlm mod_rewrite multiple mysql oop pageing parse paypal pdf php printer problem query radio random recursion regex remote script search select server sessions simple sms soap source space spam speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





