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>';
SESSION question
I am building an application , a directory for auctions.For SEO i made a script which copies a php file to all the directories paths that it creates.I made it work and into all the php files into each
Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a new user when I'm not logged in. It should redirect me back to the login page but I get this
asking for direction
I have 2 tables in my data, which are "post" and "event"I won't make a summary page for showing the condition of these two tables.so what I am thinking is SELECT the fields inside
Count
Getting the same count everytimeCode: $visitquery = mysql_query("SELECT COUNT(*) FROM visitors WHERE ownerkey = '$uuid' & region = '$selected' AND `date` < DATE_ADD(CURDATE(),
Clean URLs
Hi I was wandering if anyone has ever implemented URLs on their PHP run website using URLS like wikipedia does (i.e. http://en.wikipedia.org/wiki/Moodle)If so can you please help me learn how to setup
HOW to get the bind variables list.
I've the following problem : I've some SQL queries stored in my DB as VARCHAR2 values.
How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignored, rejected, or misunderstood in this forum. I'm surprised there isn't already any
Reg Ex
Im trying to search for the string: srv_9 (Dead ???)I thought to use preg_match, however I dont know much about reg ex. Can anyone help? Thankks
question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.I have roughly 30 files. I want to be able to edit every $_POST and $_GETCode:
scandir clients directory
hi,how can i scandir the clients directory? i need a script that when i click a button it will upload all the files in the directory$dir =