Main Form
I m trying to make a feedback form but unable to get the values of radio button. I m using BootStrap and PHP.
<form class="form-horizontal" id="feedbackForm" role="form" method="post" action="adddetails.php">
<table class="table table-bordered">
<tr>
<tr>
<td><b>No.</b></td>
<td><b>Parameter</b></td>
<td align="center" colspan="5"><b>Faculty</b></td>
</tr>
<td></td>
<td align="right"><b>Faulty Name</b> <i>[Abbreviation]</i></td>
<td><b>JS</b></td>
<td><b>AT</b></td>
<td><b>GK</b></td>
<td><b>PS</b></td>
<td><b>SB</b></td>
</tr>
</tr>
<td></td>
<td align="right"><b>Subject Code</b></td>
<td><b>MCA 202</b></td>
<td><b>MCA 204</b></td>
<td><b>MCA 206</b></td>
<td><b>MCA 208</b></td>
<td><b>MCA 210</b></td>
</tr>
<tr>
<td>1.</td>
<td>ontact forms are one of the most common elements found on a web page, and they can be used to gather just about any type of information required from your users.</td>
<td align="center">
<label>
<input type="radio" name="jsq1">1
</label>
<label>
<input type="radio" name="jsq1">2
</label></br>
<label>
<input type="radio" name="jsq1">3
</label>
<label>
<input type="radio" name="jsq1">4
</label></br>
<label>
<input type="radio" name="jsq1">5
</label>
</td>
<td align="center">
<label>
<input type="radio" name="atq1">1
</label>
<label>
<input type="radio" name="atq1">2
</label></br>
<label>
<input type="radio" name="atq1">3
</label>
<label>
<input type="radio" name="atq1">4
</label></br>
<label>
<input type="radio" name="atq1">5
</label>
</td>
<td align="center">
<label>
<input type="radio" name="gkq1">1
</label>
<label>
<input type="radio" name="gkq1">2
</label></br>
<label>
<input type="radio" name="gkq1">3
</label>
<label>
<input type="radio" name="gkq1">4
</label></br>
<label>
<input type="radio" name="gkq1">5
</label>
</td>
<td align="center">
<label>
<input type="radio" name="psq1">1
</label>
<label>
<input type="radio" name="psq1">2
</label></br>
<label>
<input type="radio" name="psq1">3
</label>
<label>
<input type="radio" name="psq1">4
</label></br>
<label>
<input type="radio" name="psq1">5
</label>
</td>
<td align="center">
<label>
<input type="radio" name="sbq1">1
</label>
<label>
<input type="radio" name="sbq1">2
</label></br>
<label>
<input type="radio" name="sbq1">3
</label>
<label>
<input type="radio" name="sbq1">4
</label></br>
<label>
<input type="radio" name="sbq1">5
</label>
</td>
</tr>
</table>
</form>
AddDetails.php
<?php
$jsq1 = $_POST['jsq1'];
echo "$jsq1";
$atq1 = $_POST['atq1'];
echo "$atq1";
?>
I want to get values of radio button and add to mysql but this is showing out put
onon
How to get values like 1,2,3,4 and 5 that can I add into the database.
You must have to write value
attribute
<input type="radio" name="sbq1" value="3">
so when form is submitted, 3
will be submitted to server
As said, you need to add a value
attribute:
<input type="radio" name="sbq1" value="1">1
value
is the actual value that will be submitted.
value
attribute:
$('input[type=radio]').each(function () { $(this).attr('value', $(this).parent().text()); });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.