Cannot update my table

can anyone help with this update…

here’s my code…

My form…

<?php
include_once("conn.php");
$uname=$_GET['UserName'];
$query=mssql_query("Select * FROM tblUser where UserName='$uname' ");
$d=mssql_query("Select DeptName from tblDept");
$user=mssql_query("Select * from tblUserLevel");

?>
<html>
<head>
	<title>Edit User</title>
</head>
<body>
<?php
	while ($row=mssql_fetch_array($query)) {
			$dept=$row['Dept'];
			$email=$row['Email'];
			$uname=$row['UserName'];
			$fname=$row['Firstname'];
			$lname=$row['Lastname'];
			$pass=$row['Pass'];
	}

?>
<table>
<form method='post' action='updateuser.php'>
<tr>
	<td>User Name:</td>	
	<td><?php echo "<label for='uname'>$uname</label>" ?></td>
</tr>
<tr>
	<td>First Name:</td>
	<td><?php echo "<input type='text' value=$fname name=fname>" ?></td>
</tr>
<tr>
	<td>Last Name:</td>
	<td><?php echo "<input type='text' value=$lname name=fname'>" ?></td>
</tr>	
<tr>
	<td>Password:</td>
	<td><?php echo "<input type='password' value=$pass name='pass' size='45'>" ?></td>
</tr>
<tr>
	<td>Re-Type Password:</td>
	<td><?php echo "<input type='password' value=$pass size='45'>" ?></td>
</tr>
<tr>
	<td>Email Address:</td>
	<td><?php echo "<input type='text' value=$email name='email' size='35'>" ?></td>
</tr>
<tr>
	<td> Department : </td>
	<td>
	<?php 
	echo "<select name='dept' tabindex='8'>";
	while($row=mssql_fetch_array($d)){
	echo "<option value=$row[DeptName]>$row[DeptName]</option>";
	}echo '</select>';
	?>
	</td>
</tr>
<tr>
	<td>User Level:</td>
	<td>
	<?php 
	echo "<select name='userlevel' tabindex='8'>";
	while($row=mssql_fetch_array($user)){
	echo "<option value=$row[UserLevel]>$row[UserLevel]</option>";
	}echo '</select>';
	?>
	</td>
</tr>
<tr>
	<td>
	<input type='submit' value='Save' name='save'>
	<input type='submit' value='Cancel' name='cancel'>
	</td>
</tr>
</form>
</table>
</body>
</html>

my code in php…

<?php
include_once("conn.php");

$uname=$_POST['uname'];
$query=mssql_query("Select * from tblUser where UserName='$uname'");

update($_GET['fname'],$_GET['lname'],md5($_POST['pass']),$_POST['email'],$_POST['dept'],$_POST['userlevel'],$con);
//nclude_once("Viewuser.php");

function update($fname,$lname,$pass,$email,$dept,$userlevel,$con){
	echo mssql_query("update tblUser Set Firstname='$fname', Lastname='$lname',Pass='$pass',Email='$email',Dept='$dept',UserLevel='$userlevel' where UserName='$uname' ");
	mssql_close($con);
}

?>

there is no error appear when i click save…help pleas…

Wrap your code in

 tags please and then once it looks neater and easier to read people might help.

what do you mean wrap?

this is were i got stuck…


<?php
include_once("conn.php");

update($_POST['uname'],$_POST['fname'],$_POST['lname'],md5($_POST['pass']),$_POST['email'],$_POST['dept'],$_POST['userlevel'],$con);

function update($uname,$fname,$lname,$pass,$email,$dept,$userlevel,$con){
	 mssql_query("Update tblUser Set Firstname='$fname', Lastname='$lname',Pass='$pass',Email='$email',Dept='$dept',UserLevel='$userlevel' where UserName='$uname' ");
	mssql_close($con);
}
?>

i transfer them to variable it does appear when i echo them…strangely they do not pass the value on the function…

Use these:

//Code here[/php ] but don't use a space in the closing tag.

Please don't PM me asking for help. I've already told you what to do.

sorry…i just figure it out…thx…