I'm trying to make a form with radio checkboxes and a textbox. The goal is to receive what is set in the radio buttons/the textbox and echo it (For now). The future goal is to upload it to MySQL, but that wont be a problem.
EDIT: i forgot to set the method="post" that solved the problem
echo "<tr>";
echo '<div class="error infonachricht">'
.'<center>Aktuell liegt ein Beurlaubungsantrag von '
.$beurlauber.' vom '.$startdate.' bis zum '.$enddate.' vor:<br><br>"'
.$begruendung
.'"<form>Annahme:<br>'.
'<input type="radio" name="annahme'.$i.'" value="Ja">Ja<br>
<input type="radio" name="annahme'.$i.'" value="Nein">Nein<br>
Neuer Grund: '.'<input type="text" size="30" maxlength="100" name="grund"><br> <br>
<input type="submit" name="clicked'.$i.'" value="Absenden">'.
'</form>';
if (isset($_POST['clicked'.$i])){
if (isset ($_POST['annahme'.$i])){
if ($_POST['annahme'.$i]=="Ja"){
echo "Ja";
}
if ($_POST['annahme'.$i]=="Nein"){
echo "Nein";
}
}
}
echo '</center></div>';
echo "</tr>";
I expected it to show either "Ja" or "Nein", but it didn't show anything at all.
when you create a form in html it should have a method. So if you add method="POST" in your tag, it should be work as a post form.
Also i recommend you to change your inputs to a <option>
tag. You can edit with css if you want some buttons. Your form should be looking like that;
<form method="POST" action="/action_page.php">
<select name="annahme">
<option value="ja">Ja</option>
<option value="nein">Nein</option>
</select>
<input type="submit" value="Submit">
</form>
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.