i'm attempting to update my table using the correct information connecting towards the follwing ID. I'll have published the code so that you can all have a look.

Here's my problem: After i submit the shape with the particulars recieved in the database, everything works successfull. However when i click submit it re-directs to my other page known as update_ac.php. Everything works fine, aside from the information within the mysql tables don't get up-to-date.

I question if anybody could have a look in the code to determine the things they think:much appreciated and feedback could be fantastic. PS I'm not the very best PHP programmer, still learning!

Here is edit.php - where teh user edits their information:

<?php
session_start();
$UserName = $_SESSION['UserName'];
require("checkLoginSession.php");
$adminid = $_GET['id'];

//CONNECTION CODE WAS HERE

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");


echo("Logged In As: $UserName");
echo "<br />";
echo("We are editing Data for ID: $adminid");
echo "<br />";
echo "<a href=test.php>Go back to panel</a>";

$id=$_GET['id'];
// Retrieve data from database 
$sql="SELECT * FROM admin WHERE id='$id'";
$result=mysql_query($sql) or die(mysql_error());

$rows=mysql_fetch_array($result);
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="post" action="update_ac.php">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td colspan="3"><strong>Update data in mysql</strong> </td>
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="center">&nbsp;</td>
<td align="center">&nbsp;</td>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>Main Content</strong></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center"><input name="name" type="text" id="name" value="<? echo $rows['name']; ?>"></td>
<td align="center"><input name="mainContent" type="text" id="mainContent" value="<? echo $rows['mainContent']; ?>" size="15"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>"></td>
<td align="center"><input type="submit" name="Submit" value="Submit"></td>
<td>&nbsp;</td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<?
mysql_close();
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Page</title>
</head>

<body>
<h2>Edit Page (<?php echo ("$adminid"); ?>)</h2>
</body>
</html>

Here is the update_ac.php:

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// update data in mysql database 

$firstName = $_POST["name"];
$mainText = $_POST["mainContent"];

$sql="UPDATE admin SET name='$firstName', mainContent='$mainText' WHERE id='$id'";
$result=mysql_query($sql) or die(mysql_error());;

// if successfully updated. 
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='test.php'>Back to panel</a>";
}

else {
echo "ERROR";
}

?>

OK Men EDIT HERE:

If within the Update_ac.php basically alter the following line for this:

$sql="UPDATE admin SET name='$firstName', mainContent='$mainText' WHERE id='1'";

The data now will get up-to-date, therefore means something is certainly going wrong with my ID variable