OK, here's the deal. This code is really weirdly formatted (sorry!) and hard to understand, so I'm going to try and make it as easy as possible. Here's a breakdown of what the user should do:
1. The user sees a list of his classes (stored in the classes table in the DB). He picks one.
Code: [Select]$instructor = $_COOKIE['USERNAME'];
$query = ("SELECT * FROM classes WHERE instructor='$instructor'");
$sql = mysql_query($query) or die(mysql_error());
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<table border="1" cellspacing="2" cellpadding="3">';
while ($row = mysql_fetch_array($sql))
{
echo '<tr><td>';
echo $row['id'];
echo '</td><td>';
echo $row['session'];
echo '</td><td>';
echo $row['day'];
echo '</td><td>';
echo $row['time'];
echo '</td><td>';
echo $row['level'];
echo '</td><td>';
$class_id = $row['id'];
echo '<input type = "hidden" name = "class_id" value = "'.$class_id.'" />';
echo '<input type = "submit" name = "pickclass" value = "Run" /></form>';
echo '</td></tr>';
}
echo '</table>';
2. The user is shown a list of the students in that class. He picks one.
Code: [Select] if (isset($_POST['pickclass'])) {
echo '<table>';
$class_id = $_POST['class_id'];
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<tr><td><strong>Instructor: </td></tr></table>';
echo $_COOKIE['USERNAME'];
$instructor = $_COOKIE['USERNAME'];
echo '<table border="1" cellspacing="2" cellpadding="3">';
echo '<tr><td>ID</td><td>First</td><td>Last</td><td>Gender</td><td>Level</td></tr>';
$query = ("SELECT * FROM `students` WHERE classid='$class_id' LIMIT 0, 30");
$sql = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($sql)) {
echo '<tr><td>';
echo $row['id'];
echo '</td><td>';
echo $row['fname'];
echo '</td><td>';
echo $row['lname'];
echo '</td><td>';
echo $row['gender'];
echo '</td><td>';
echo $row['level'];
echo '</td><td>';
echo '<input type = "hidden" name = "id" value = "'.$row['id'].'" />';
echo '<input type = "hidden" name = "fname" value = "'.$row['fname'].'" />';
echo '<input type = "hidden" name = "lname" value = "'.$row['lname'].'" />';
echo '<input type = "hidden" name = "gender" value = "'.$row['gender'].'" />';
echo '<input type = "hidden" name = "level" value = "'.$row['level'].'" />';
echo '<input type = "submit" name = "submit" value = "GO!" /></td></tr></table></form>';
Here's the problem: the only thing showing up under step two is the table headers (i.e. First, Last, etc.)
I don't know why. I feel like it's a tiny problem but I can't find it! Help!
----
In reality, the code looks like this. Don't hurt me!
Code: [Select]//something else comes before this
else
{
if (isset($_POST['pickclass'])) {
echo '<table>';
$class_id = $_POST['class_id'];
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<tr><td><strong>Instructor: </td></tr></table>';
echo $_COOKIE['USERNAME'];
$instructor = $_COOKIE['USERNAME'];
echo '<table border="1" cellspacing="2" cellpadding="3">';
echo '<tr><td>ID</td><td>First</td><td>Last</td><td>Gender</td><td>Level</td></tr>';
$query = ("SELECT * FROM `students` WHERE classid='$class_id' LIMIT 0, 30");
$sql = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($sql)) {
echo '<tr><td>';
echo $row['id'];
echo '</td><td>';
echo $row['fname'];
echo '</td><td>';
echo $row['lname'];
echo '</td><td>';
echo $row['gender'];
echo '</td><td>';
echo $row['level'];
echo '</td><td>';
echo '<input type = "hidden" name = "id" value = "'.$row['id'].'" />';
echo '<input type = "hidden" name = "fname" value = "'.$row['fname'].'" />';
echo '<input type = "hidden" name = "lname" value = "'.$row['lname'].'" />';
echo '<input type = "hidden" name = "gender" value = "'.$row['gender'].'" />';
echo '<input type = "hidden" name = "level" value = "'.$row['level'].'" />';
echo '<input type = "submit" name = "submit" value = "GO!" /></td></tr></table></form>';
MYSQL gen help
This is my Mysql gen. can anyone tell me why this echosMID(networkset.networkid, 3, 3) AS "MNC" SELECT FROM scan JOIN gps ON scan.gpsid = gps.gpsid JOIN gsmscanset ON scan.scanid =
Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside another one.What I'm trying to achieve is that I want to display all of the records in one table
ORA-00932: inconsistent datatypes: expected - got CLOB
SO : windows xp
Pulling out some result data from MYSQL
Hey Guys, I've built a PHP page that has a for just imagine something like registration form, So obviously it posts data into my table in my DB, So Now what I’m trying to do is creating a form
Easy administration on MySQL databases
My website is database driven and I am very tired of manually making queries to my tables in order to update my site. I decided to make a form that only I should have access to that PHP can filter and
From Header Showing 'Unkown' In Hotmail? Why?
Code: $to = $row_GetID['email_addr'].',sales@mywebaddress.co.uk'; $subject = 'Thank you for your www.mywebaddress Order'.' ('.$row_GetID['ordernum_ID'].')';$headers = 'From:web@mywebaddress.co.uk';if
Track downloads' status
Hello,I need to make somehow, some system, to track whether downloads are completed or failed. I tried to make this via php.Tried to limit the connection speed for smaller downloads (to have the time
Multiple while loops
I have several DB queries that I know should be returning results and aren't. I have a feeling it has to do with the several while loops that should be outputting the data. One more issue is that
TemplatePower & AJAX
Hi all,I'm currently implementing some AJAX features in my PHP-framework (which is based on TemplatePower) and I have encountered a problem:I have a block which holds a message-div. This block is
HTML Viewer HIDE scrollbar
How can I disable scrollbars in a HTML Viewer control? I can't hide them. Even i have enough space but i am getting this grey inactive scrollbar....