You are NOT setting method on your forms… so it is probably defaulting to GET. Wait, no… it’s there… just getting chopped off. Given the invalid form structure I’d be surprised if this even worked anywhere.
That’s a PERFECT example of “opening and closing PHP for NOTHING”, and the markup is the biggest pile of nonsense I’ve seen in ages. multiple H3’s when you aren’t even starting new sections, H2 that should probably be a legend, tables for nothing, paragraphs inside heading tags, value setting in the middle of your output, invalid form structure, plaintext instead of labels…
Basically 2.2k of gibberish doing 1.7k’s job.
ASSUMING we keep the tables for layout (boo)
<?php
require_once("includes/session.php");
session_register ("student_id");
require_once("includes/connection.php");
require_once("includes/functions.php");
confirm_logged_in();
find_selected_page();
include("includes/header.php");
echo '
<table id="structure">
<tr>
<td id="navigation">
',student_navigation($sel_yesnoflag, $sel_yesnoquestion),'
<br /><br />
<a href="logout_student.php"> <b>Click here to Log out</b></a>
</td>
<td id="page">
<h3>
',$_SESSION['username'],'\\'s account<br />
<small>Please answer the following True/False questions.</small>
</h3>';
if ($sel_yesnoquestion) {
$student_id = $_SESSION['user_id'];
$yesnoquestion_id = (int) mysql_prep($_GET['yesnoquestion']);
echo '
<form
action="create_yesno_answer.php?ynflag=',$sel_yesnoflag['id'],'"
method="post"
>
<fieldset>
',$sel_yesnoquestion['id'],'
',$yesnoquestion_id,'
<legend><span>
',htmlentities($sel_yesnoquestion['yesnoquestion_name']),'
</span></legend>
<p>
',htmlentities($sel_yesnoquestion['yesnoquestion_content']),'
</p>
<input type="radio" name="stu_yes_no_answer" id="stuTrue" value="1" />
<label for="stuTrue">True</label>
<input type="radio" name="stu_yes_no_answer" id="stuFalse" value="0" />
<label for="styFalse">False</label><br />
<br />
<input type="submit" name="submit" value="submit" />
</fieldset>
</form>';
} else {
echo '
<i>* <u>Note:</u> To answer any question, Please make sure select the questions from the categories.</i>';
}
echo '
</td>
</tr>
</table>';
require("includes/footer.php");
?>
<?php
require_once("includes/session.php");
session_register ("student_id");
require_once("includes/connection.php");
require_once("includes/functions.php");
confirm_logged_in();
find_selected_page();?>
include("includes/header.php");
echo '
<table id="structure">
<tr>
<td id="navigation">
',student_navigation($sel_yesnoflag, $sel_yesnoquestion),'
<br /><br />
<a href="logout_student.php"> <b>Click here to Log out</b></a>
</td>
<td id="page">
<h3>
',$_SESSION['username'],'\\'s account<br />
<small>Please answer the following True/False questions.</small>
</h3>';
if ($sel_yesnoquestion) {
$student_id = $_SESSION['user_id'];
$yesnoquestion_id = (int) mysql_prep($_GET['yesnoquestion']);
echo '
<form
action="create_yesno_answer.php?ynflag=',$sel_yesnoflag['id'],'"
method="post"
>
<fieldset>
',$sel_yesnoquestion['id'],'
',$yesnoquestion_id,'
<legend><span>
',htmlentities($sel_yesnoquestion['yesnoquestion_name']),'
</span></legend>
<p>
',htmlentities($sel_yesnoquestion['yesnoquestion_content']),'
</p>
<input type="radio" name="stu_yes_no_answer" id="stuTrue" value="1" />
<label for="stuTrue">True</label>
<input type="radio" name="stu_yes_no_answer" id="stuFalse" value="0" />
<label for="styFalse">False</label><br />
<br />
<input type="submit" name="submit" value="submit" />
</fieldset>
</form>';
} else {
echo '
<i>* <u>Note:</u> To answer any question, Please make sure select the questions from the categories.</i>';
}
echo '
</td>
</tr>
</table>';
require("includes/footer.php");
?>
… and even then I’m not sold on H3 being the correct tag, the table has NO business even being in there, etc, etc…
On the logic side, you aren’t setting either of the radio buttons to selected, and you have no checks for ‘isset’ – also it would be a really good idea to TYPECAST before sending $_POST to the query.
Though what type is student_answer in the database? Is that integer? an SQL boolean? If you feed 0 and 1 to SQL bool that typically does NOT work…