•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,999 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,161 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 15732 | Replies: 3
![]() |
•
•
Join Date: Aug 2005
Posts: 9
Reputation:
Rep Power: 0
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>
•
•
Join Date: Jan 2005
Location: Sheffield, UK
Posts: 294
Reputation:
Rep Power: 4
Solved Threads: 6
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:
Rep Power: 0
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?
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]
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- 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)


Linear Mode