This question already has an answer here:
- The 3 different equals 5 answers
On "form.html", I have a basic HTML form:
<form method="post" action="submit.php">
<input type="radio" name="SQ1" value="y"> Yes<br>
<input type="radio" name="SQ1" value="n"> No<br>
<input type="submit">
</form>
On "submit.php", I have a table. I am trying to change the text inside the table based on what radio button is selected.
<table id="results">
<tr>
<th>h1</th>
<th>h2</th>
<th>h3</th>
<th>h4</th>
<th>h5</th>
<th>h6</th>
</tr>
<tr>
<td><?php
$sq1 = $_POST["sq1"];
if ($sq1 = y) {
echo "0";
}
else {
echo "1";
}
?></td>
<td><?php
$sq1 = $_POST["sq1"];
if ($sq1 = y) {
echo "0";
}
else {
echo "1";
}
?></td>
<td><?php
$sq1 = $_POST["sq1"];
if ($sq1 = y) {
echo "1";
}
else {
echo "0";
}
?></td>
<td><?php
$sq1 = $_POST["sq1"];
if ($sq1 = y) {
echo "1";
}
else {
echo "0";
}
?></td>
<td><?php
$sq1 = $_POST["sq1"];
if ($sq1 = y) {
echo "1";
}
else {
echo "0";
}
?></td>
<td><?php
$sq1 = $_POST["sq1"];
if ($sq1 = y) {
echo "1";
}
else {
echo "0";
}
?></td>
</tr>
</table>
No matter what button is selected, the data appears as if $sq1 = y.
</div>