Location: PHPKode > projects > PHP MySQL Address Book > addressbook/addedituser.php
<?php
require("sesionchk.php");
?>

<!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><?php
require("title.php");
?></title>

</head>

<body>
<p>
  <?php
require("links.php");
include 'library/config.php';
include 'library/opendb.php';
if ($_GET['ID']!==-1)
{
if ($_GET['mod']=="d")
{
//<button onclick='window.close()' value='No'/>";
$q="SELECT `user_id` FROM `contacts` WHERE `user_id` =".$_GET['ID']." OR `user_id2` =".$_GET['ID'];
mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8'); 
$r = mysql_query($q);
			if (mysql_num_rows($r) > 0)
			{
			echo "<strong>Sorry,unable to delete this as this user had added/edited some contacts,you can disable this account</strong><hr>";
			}
			else
			{
			echo "<strong>Do you really want to Delete this Record? <a href=\"library/deluser.php?ID=".$_GET['ID']."\">Yes</a> <a href='usrmanagmnt.php'> No </a></strong><hr>";
			}

}
else
{

}
//$query = "SELECT FirstName,EmailAddress,ID,Notes,imagename FROM contacts where ID=" .$_GET['ID'];
$query  = "SELECT `user`,`usr_level`,`addedon`,`ID`,`isEnabled` FROM cal_accounts where ID=" .$_GET['ID'];
mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8'); 
//echo $query;
/*$db_charset = mysql_query( "SHOW VARIABLES LIKE 'character_set_database'" );
$charset_row = mysql_fetch_assoc( $db_charset );
mysql_query( "SET NAMES '" . $charset_row['Value'] . "'" );
unset( $db_charset, $charset_row );

*/
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
}
/*
    echo "Name :{".$row['FirstName']."} <br>" .
         "Subject : {".$row['EmailAddress']."} <br>" ;

 $name=$row['FirstName'];
 echo $name;*/
//include 'library/closedb.php';
?> 
</p>
<form id="form1" name="form1" method="post" action="saveusr.php">
  <table width="50%" border="1">
    <tr>
      <td>User Name </td>
      <td><label>
	  <?php
	  if ($_GET['ID']==-1)
	  {
      echo "<input type='text' name='user_id' />";
	  }
	  else
	  {
	  echo $row['user'];
	  echo "<input type='hidden' name='user_id' value=".$row['user'].">";
	  }
	  ?>
	  

      </label></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><label>
      <input type="password" name="user_password" />
      </label></td>
    </tr>
    <tr>
      <td>Retype Password </td>
      <td><label>
      <input type="password" name="reuser_password" />
      </label></td>
    </tr>
    <tr>
      <td>User Level </td>
      <td><p>
        <label>
		<?php
		if (trim($row['usr_level'])==2)
		{
         echo "<input name='usr_level' type='radio' value='2' checked='checked' />";
		}
		else
		{
         echo "<input name='usr_level' type='radio' value='2' />";
		}
		?>

          Super User </label>
        <br />
        <label>
		<?php
		if (trim($row['usr_level'])==3)
		{
         echo "<input name='usr_level' type='radio' value='3' checked='checked' />";
		}
		else
		{
         echo "<input name='usr_level' type='radio' value='3' />";
		}
		?>

          Normal User</label>
        <br />
      </p>        <label></label></td>
    </tr>
    <tr>
      <td>Enable or Disable A/C </td>
      <td><p>
        <label>
		
		
		<?php
		if (trim($row['isEnabled'])==1)
		{
         echo "<input type='radio' name='isEnabled' value='1' checked='checked' />";
		}
		else
		{
         echo "<input type='radio' name='isEnabled' value='1'  />";
		
		}
		?>
          
          Enable</label>
        <br />
        <label>
				<?php
		if (trim($row['isEnabled'])==-1)
		{
          echo "<input type='radio' name='isEnabled' value='-1' checked='checked' />";
		}
		else
		{
          echo "<input type='radio' name='isEnabled' value='-1' />";
		
		}
		?>

        
          Disable</label>
        <br />
      </p>        <label></label></td>
    </tr>
    <tr>
      <td><label>
        <input type="submit" name="Submit" value="Save" />
      </label></td>
      <td>
	  
	  <input type="hidden" name="idofusr" value="<?php echo $_GET['ID']; ?>"></td>
    </tr>
  </table>
</form>
<!-->>>>>>>>>>>>>>>>>>>>>>>>
Here
>>>>>>>>>>>>>>>>>>>>>>>>
--><br>
<?

include 'library/closedb.php';
?>
<blockquote>&nbsp;</blockquote>
</body>
</html>
Return current item: PHP MySQL Address Book