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>

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:

if(isset($_POST['checkbox_name'])) echo 'checked';
<input name="cd0" type="checkbox"  checked="checked">
<?
if(isset($_POST['cd0'])){ echo 'checked';} 
?>

dont works, can u help me?

<input name="cd0" type="checkbox" checked="checked">
<?
if(isset($_POST)){ echo 'checked';}
?>

dont works, can u help me?

You need to post the form.


myform.php

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

check.php

<?PHP
if(isset($_POST['cd0'])){ echo 'checked';} 
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.