I wanted to know how can I detect the checkbox values and selectbox entered in my registration form.
This is the select:
<p><label for="favorite">שחקן המועדף עליך</label>
<select name = "favor">
<option> </option>
<option value="פרקינס">דורון פרקינס</option>
<option value="סופוקליס שחורציאניטיס">סופוקליס שחורציאניטיס</option>
<option value="עומרי כספי">עומרי כספי</option>
<option value="דייויד בלו">דייויד בלו</option>
</select></p>
and that’s the checkbox:
<p><label for="checkbox">אופנוע</label><input type="checkbox" name="bike" id="bike" value="bike" /> </p>
<p><label for="checkbox">מכונית</label><input type="checkbox" name="car" id="car" value="car" /> </p>
How can I get the selected option and the selected boxes in the checkbox on clientside?
If anything is needed to explain let me know please,
Thank you!
Edit: I will explain myself a bit more, I’m having a registration form, which has checkboxes and tags. I want to know what the client chose and insert it into my SQL DB, I need to know how to get what the client pressed, like on what box he ticked V, what option he chose.
If you want to get this client-side, you can use jQuery to harvest the results:
and
Note that your select doesn’t have an id, only a name, so you’ll also need to change it to this:
If you want to get this server-side, you can use something like this:
Note that most browsers will send a post value if the checkbox is checked with a value of “checked” or “true”, and not send it if it isn’t checked.
Even better is to replace these html tags with asp.net webforms tags like so:
That way you can do this server-side: