i am having some problems posting some values into a form when i click edit. i have checked to make sure that the variables contain the values that i want however they are not posting back to the form.
here is my code below.
if ($_GET['mode'] == 'edit')
{
$c=$_GET['id'];
echo"$c";
// editing an existing entity
// check for value of id
/*if (!$_GET['coursecode'])
{
echo "error: no coursecode specified, <a href=\"{$_SERVER['PHP_SELF']}\">click here to continue</a>";
exit;
}*/
if (!$_POST['submit'])
{
$con = mysql_connect("$hostname","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
// $sql= "SELECT * FROM rules WHERE type='prerequisite' ";
//$result=mysql_query($sql);
// first access to form
// checking if the record is in the database
//$sql= "SELECT * FROM rules WHERE type='prerequisite' ";
//$q = "SELECT first_name,last_name,password FROM students WHERE id_no='$c' ";
//if ($result=mysql_query($sql))
$q = "SELECT first_name,last_name,password FROM students WHERE id_no='$c' ";
if (!$result = mysql_query($q) )
{
//extract($row);
//$_POST['id']=$id_no;
echo "error: user with id {$_GET['id']} does not exist, <a href=\"{$_SERVER['PHP_SELF']}\">click here to continue </a>";
exit;
}
else
{
$row = mysql_fetch_array($result, MYSQL_BOTH);
if (mysql_num_rows($result)!=0) {
echo "Found Information!";
}else{
die("No Information Found!");
}
//echo "<p>", $row['first_name'], "</p>";
//echo "<p>", $row['last_name'], "</p>";
//echo "<p>", $row['password'], "</p>";
$_POST['id']=$c;
$_POST['firstname']=$row['first_name'];
$_POST['last_name']=$row['last_name'];
$_POST['password']=$row['password'];
$_POST['repassword']=$row['password'];
//echo "<p>", $_POST['password'], "</p>";
}
print_form();
}
can someone offer some assistance here please