mercredi 25 mars 2015

HTML. How to pass check box value to php?

I have form and here is check box, how to pass value from check box to PHP? For example.: If checkbox is checked pass 1, if not checked 0.


I'm using following:



<input type="checkbox" name="letter" value="letter" id="letter" checked="checked">


This is my form:



<form class="form" method="post" action="GetFbId.php">
<h2>Registration</h2><hr/>
<label>First Name: </label>
<input type="text" name="first_name" id="first_name" required>

<label>Last Name: </label>
<input type="text" name="last_name" id="last_name" required>

<label>City: </label>
<input type="text" name="city" id="city" required>

<label>Email: </label>
<input type="text" name="email" id="email" required><br>

Accept to get letters
<input type="checkbox" name="letter" value="letter" id="letter" checked="checked">

<input type="submit" name="register" id="register" value="Register">
</form>




Aucun commentaire:

Enregistrer un commentaire