I have a working code where the result of a query is passed to another page. The query comes with only a single answer which is what I want. What I want however is for the field I am passing to be hidden. There is also an option field with multiple answers being passed at the same time, which has to remain. So what I'm asking is for a proper way to pas the hidden field so I don't get all the errors when I do it the way I was trying (ie The wrong way)
Here's the working code that I have. I want the first option field to be a hidden field. Any help is appreciated
$studentquery="SELECT * from student ORDER BY ssurname";<br>
//Do Query
$studentresult = mysql_query ($studentquery);
$options="";
echo "<form action='addstudenttofamily1c.php' method='POST'>";
$familychoice = "SELECT * from hostfamily WHERE hid= '".mysql_real_escape_string($hostfamily). "'";
$resultfamilychoice = mysql_query ($familychoice);
$options2="";
echo "<select name='element_1' id='element_1'>";
while ($rowfam=mysql_fetch_array($resultfamilychoice))
{
echo "<option value='$rowfam[hid]'>$rowfam[hfsurname] $rowfam[hfmname]</option><br/>";
}
echo "</select>";
echo "<select name='element_3' id='element_3'>";
while($row=mysql_fetch_array($studentresult))
{
echo "<option value='$row[sid]'>$row[sname] $row[ssurname]</option>";
}
echo "</select><input type='submit' name='submit3' value='Replace Student'>";
echo "</form>";
echo"</td>";
echo" </tr>";
This is how you can store a hidden value for a form:
<input type="hidden" name="SomeHiddenField" val="ValueOfThisField" />
To which you could code it in PHP to make it dynamic also.