if (isset($_POST['submit']))
in the following code wont execute, same goes for the if(isset($_POST['Q1']))
<form action='' onsubmit="return validateQuiz()" method="post">
<section>
<p>Who cares?</p>
<input type="radio" name="Q1" value="Q1_1">
<label for="Q1_1">Me?</label><br>
<input type="radio" name="Q1" value="Q1_2">
<label for="Q1_2">No one</label><br>
<input type="radio" name="Q1" value="Q1_3">
<label for="Q1_3">That guy</label>
</section>
<br>
<input id="submit" type="submit" value="submit" name="submit">
</form>
In the same file there goes a php block right under this form that goes:
<?php
if (isset($_POST['submit'])) {
if(isset($_POST['Q1']))
{
echo "You have selected :" . $_POST['Q1']; // Displaying selected value not working
}
}
?>
For further information, I've tried doing pure if (isset($_POST['submit']))
to see what the real problem was, and it doesn't even set the isset to true even tho the form was submitteed. I've also tried the GET method instead of POST, still doesnt work. Pure echo-code without anything else works so php is working as intended.
Here is a picture of how it looks if anyone is wondering and such, Right under submit should appear text of what was selected.