I am a newbie, but inherited some code I want to use (here is an extract)
This drop down list shows all the students in my table; a teacher selects a student by choosing the student name on the drop down list (there is no submit button as the teacher later chooses in a similar way from a merit category table ) Eventually there is a "SAVE THIS MERIT" button, which moves the user on to the SAVE-MERITS php page.
<form name = "frmstudent" action="mer_merit.php" method="get">
<select
size="1"
name="fstudentid"
onchange='document.frmstudent.submit()'>
<?php
require 'mer_connect.php';
$csql = "select * from mer_students order by studentname";
$result = mysql_query($csql);
$nrows = mysql_num_rows($result);
if ($nrows == -1) {echo 'Unexpected error in the query:<br/>'; die($csql);};
$cdummy = (!isset($p_fstudentid) ? "selected=\'selected\'" : "");
$row = mysql_fetch_array($result);
echo('<option value="0"'.$cdummy.'>(select a student)</option>');
while ($row = mysql_fetch_array($result))
{
if ($p_fstudentid == $row['id'])
{
echo('<option value = '.$row['id'].' selected=\'selected\' >'.$row['studentname'].'</option>');
$cdummy = substr($row['group'],2,1);
}
else
{
echo('<option value="'.$row['id'].'" >'.$row['studentname'].'</option>');
}
}
?>
</select>
<br/><br/>
////////////////////////////////////////
When all the data is selected via drop down, I move onto a new php page to save the data into a new (merits) table; however I'm not sure how to INSERT the variables from the above code into the merits table. What variables will be carried over, and can I simply INSERT INTO 'merits' ('Studentid', 'Studentname') VALUES (..??what goes here?)
Many thanks in advance
John
Would it help to post all the code?