Slainte,
Could someone help me the the following question.
I have a dropdown list which is pulling from a mysql
database.
What i want to do is keep the item that is selected in the
dropdown visible to the user if they navigate back to check
their inputs. I am using sessions but cannot figure out to
apply them to the code for dropdowns
Here's my code
----------------------------------------------------------------------------------------------------------------------
echo "<option value=\"$row[0]\">$row[1]</option>\n";
----------------------------------------------------------------------------------------------------------------------
Hence I want to make $row[1] a session variable to that it
stays visible until the form is submitted.
Here's the entire code so that it makes more sense
----------------------------------------------------------------------------------------------------------------------
echo'<tr>
<td colspan="2" class="labelcell"><label for="junior_subject_id">Select Subject:</label></td>';
echo'<td colspan="2" class="fieldcell2"><select name="junior_subject_id">';
$query_result = mysql_query ('SELECT * FROM junior_subjects ORDER BY junior_subject_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
echo "<option value=\"$row[0]\">$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
----------------------------------------------------------------------------------------------------------------------
Tks in advance i know you guys can help
Could someone help me the the following question.
I have a dropdown list which is pulling from a mysql
database.
What i want to do is keep the item that is selected in the
dropdown visible to the user if they navigate back to check
their inputs. I am using sessions but cannot figure out to
apply them to the code for dropdowns
Here's my code
----------------------------------------------------------------------------------------------------------------------
echo "<option value=\"$row[0]\">$row[1]</option>\n";
----------------------------------------------------------------------------------------------------------------------
Hence I want to make $row[1] a session variable to that it
stays visible until the form is submitted.
Here's the entire code so that it makes more sense
----------------------------------------------------------------------------------------------------------------------
echo'<tr>
<td colspan="2" class="labelcell"><label for="junior_subject_id">Select Subject:</label></td>';
echo'<td colspan="2" class="fieldcell2"><select name="junior_subject_id">';
$query_result = mysql_query ('SELECT * FROM junior_subjects ORDER BY junior_subject_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
echo "<option value=\"$row[0]\">$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
----------------------------------------------------------------------------------------------------------------------
Tks in advance i know you guys can help