i"ve got multiple problems

i"ve got multiple problems

am 17.06.2005 07:04:27 von LS

1. When I select an assignment, the class roster disappears. I don't want it to show up until I select an assignment.

2. I want to be able to enter grades and submit all with only one submit button.

This is my code. File is loaded at http://lynnesmith.net/teacher/entergrades.php
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++


Gradebook




include("connect.php");
$CONNECTION = mysql_connect($DB_SERVER, $DB_USER, $DB_PASS) or die ('I
cannot connect to the database because: ' . mysql_error());
mysql_select_db($DB_NAME) or die("Couldn't select database.");
?>








if(isset($_POST['checkclass']))
{
$CID = $_POST['classid'];

echo "
";
echo "";
echo"";
echo "
";
}

if (isset($_POST['checkassign']))
{
$AID = $_POST['assignid'];
}
?>



$SQL2 = "SELECT * FROM $DB_TABLE2 WHERE classid = '$CID' ORDER BY
lastname, firstname";
$RESULT2 = mysql_query($SQL2, $CONNECTION) OR die ("Query failed.");
$NUM2 = mysql_num_rows($RESULT2);
if ($NUM2 > 0)
{
echo "";
echo "";
echo "";
echo "";
while ($ROW = mysql_fetch_array($RESULT2))
{
$SRECORD = $ROW["record"];
$SID = $ROW["studentid"];
$FNAME = $ROW["firstname"];
$LNAME = $ROW["lastname"];
echo "";
}
echo "";
echo "";
echo "
$CNAME
ID#StudentGrade
$SID$LNAME, $FNAME NAME='grade' SIZE='3' MAXLENGTH='3'>
";
}
?>
if(isset($_POST['grades']))
{
$ANUM = $_POST['anum'];
$GRADE = $_POST['grade'];
$SQL3 = "INSERT INTO $DB_TABLE3 (classid, studentid, assignmentid,
grade) VALUES ('$CID', '$SID', '$AID', '$GRADE')";
}
?>


Re: i"ve got multiple problems

am 17.06.2005 08:57:35 von David Quinton

On Fri, 17 Jun 2005 05:04:27 GMT, LS wrote:

>1. When I select an assignment, the class roster disappears. I don't want it to show up until I select an assignment.

I'm no expert, but it looks like you have multiple instances of a form
with the same name.

--
Locate your Mobile phone:
Great gifts:

Re: i"ve got multiple problems

am 11.11.2005 19:40:42 von TomB

It looks like you aren't retaining the selected class value, and that is
resetting the page.

T


LS wrote:

> 1. When I select an assignment, the class roster disappears. I don't
> want it to show up until I select an assignment.
>
> 2. I want to be able to enter grades and submit all with only one
> submit button.
>
> This is my code. File is loaded at
> http://lynnesmith.net/teacher/entergrades.php
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
>
>
> Gradebook
> > HREF="../stylesheets/gradebook.css">
>
>
>
> > include("connect.php");
> $CONNECTION = mysql_connect($DB_SERVER, $DB_USER, $DB_PASS) or die ('I
> cannot connect to the database because: ' . mysql_error());
> mysql_select_db($DB_NAME) or die("Couldn't select database.");
> ?>
>


>

>

>
>
>

>
> > if(isset($_POST['checkclass']))
> {
> $CID = $_POST['classid'];
>
> echo "
";
> echo "";
> echo"";
> echo "
";
> }
>
> if (isset($_POST['checkassign']))
> {
> $AID = $_POST['assignid'];
> }
> ?>
>

>

>
> > $SQL2 = "SELECT * FROM $DB_TABLE2 WHERE classid = '$CID' ORDER BY
> lastname, firstname";
> $RESULT2 = mysql_query($SQL2, $CONNECTION) OR die ("Query failed.");
> $NUM2 = mysql_num_rows($RESULT2);
> if ($NUM2 > 0)
> {
> echo "";
> echo "";
> echo "";
> echo "";
> while ($ROW = mysql_fetch_array($RESULT2))
> {
> $SRECORD = $ROW["record"];
> $SID = $ROW["studentid"];
> $FNAME = $ROW["firstname"];
> $LNAME = $ROW["lastname"];
> echo "";
> }
> echo "";
> echo "";
> echo "
$CNAME
ID#StudentGrade
$SID$LNAME, $FNAME > NAME='grade' SIZE='3' MAXLENGTH='3'>
";
> }
> ?>
> > if(isset($_POST['grades']))
> {
> $ANUM = $_POST['anum'];
> $GRADE = $_POST['grade'];
> $SQL3 = "INSERT INTO $DB_TABLE3 (classid, studentid, assignmentid,
> grade) VALUES ('$CID', '$SID', '$AID', '$GRADE')";
> }
> ?>
>

>
>
>