Hi Guys,
im trying to troubleshoot the bottom half of my code, the submission form. There is certainly something wrong with my syntax down there. I have a combination of html form code and php tags.
If you cut and paste this code in an editor (i use phped) the form code should all appear in grey indicating html in my case. But it shows up in red which means that its recognising it as php.
Can anybody help?
-Adrian
<h2>Edit A Student</h2>
<?php include("dbconnect.php");
// First connect.
$query = "SELECT * FROM student_table WHERE student_id=$student_id";
// Create a query to find the requested students information.
if (!$result = mysql_query($query)) {
die("Could not execute the query.");
}
// If the query does not work the script will be terminated by the
// function die()
$fields = mysql_fetch_array($result);
// The above function will use the result returned from your query
// and create an Array which we have named $fields. The reason for
// choosing this name is because when we ran the query, in theory
// it should only return a single row from the table as there is
// only one student with the requested student_id. We can refer to
// any of the array elements using associative or numeric keys.
// For Example: $fields[first_name] or $fields[1]
// These both return the same value.
// Now using this array we can give a default value to your form
// fields
?>
<form method=post action="edit_student_entry.php">
Student ID: <input type=text size=5 name=student_id <?php value=\"$fields[student_id]\" ?>>
<br>
First Name: <input type=text size=20 name=first_name <?php value=\"$fields[first_name]\" ?>>
<br>
Last Name: <input type=text size=15 name=last_name <?php value=\"$fields[last_name]\" ?>>
<br>
Module ID: <input type=text size=4 name=module_id <?php value=\"$fields[module_id]\" ?>>
<br>
<input type=submit name=submit value="Submit">
<input type=reset name=reset value="Clear">