Hi All,

I think I'm lost.....

Here's my problem, I have a searchUser.php which allows the user to enter the Employee ID and submit (which searches for the user). The result is displayed from the chunk of code below. I want to allow the user to append a particular field, therefore i added the select to the table...whenever i click the update button, nothing happens....

{
	   echo"<tr><td>";
	   print("<center>
	   
	   		  <table border='1' width='900'>
				<tr align='center' bgcolor='#339900'>
					<td><font face='verdana' size='2' color='white'><b>Employee ID</b></font></td>
					<td colspan='2'><font face='verdana' size='2' color='white'><b>Name</b></font></td>
					<td><font face='verdana' size='2' color='white'><b>Initials</b></font></td>
					<td><font face='verdana' size='2' color='white'><b>Username</b></font></td>
					<td><font face='verdana' size='2' color='white'><b>Access Level</b></font></td>
					<td colspan='2'><font face='verdana' size='2' color='yellow'><b>Select Access to be Granted and Update</b></font></td>
				</tr>");
		for($counter=0; $myrow=mysql_fetch_row($result); $counter++)
		{
			print("<tr>");
			foreach($myrow as $key => $value)
			print("<td><font face='verdana' size='2'>$value</font></td>");
			print("<form action='update.php' method='post'>");
			print("<td><select name=accessType width='15'><option value=".$myrow[5].">Choose Access Level</option><option value=NULL>NULL</option><option value=User>User</option><option value=Admin>Admin</option><option value=SysAdmin>SysAdmin</option></select></td>");
		} 
			print("<td><input name='btnUpdate' type='submit' value='Update' /></td>");	
			print("</tr></table></form></center>");						   	
	}

here is the update.php code:

<?php

	include("./connect.php");
	
	global $conn;
	
	$accessType = $_POST['accessType'];

	$btnUpdate = $_POST['btnUpdate'];
		

					
	if(isset($btnUpdate))
	{
		$empNo = $_GET[$myrow[0]]; 
		
		$q1 = "UPDATE Operators SET accessLevel=".$accessType." WHERE EmployeeID =".$empNo;
		$result1 = mysql_query($q1, $conn) or die("Update not successful");
	}
?>

I reposted this query, and it was solved there...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.