วันอังคารที่ 5 มีนาคม พ.ศ. 2556

update


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

<body>

<p>
<?php
require('config.php');
$myConn = mysql_connect($hostname_library, $username_library, $password_library) or die(mysql_error());
mysql_select_db($database_library,$mycon);


$update = mysql_query("update user set password = '$street_conf' where username ='".$_GET['name']." ");
?>
</p>


<form id="form1" name="form1" method="post" action="update1.php">
<?php
$nameup = $_GET['name'] ;
?>
<table width="399" border="0">
<tr>
<td width="97" bgcolor="#FF9900">Username</td>
<td width="286" bgcolor="#FFCC66"><input type="hidden" name= "txtname" value="<?php echo $_GET['name'] ?>"><?php echo $_GET['name'] ?>
        </td>
  </tr>
<tr>
<td bgcolor="#FF9900">Password</td>
<td bgcolor="#FFCC66"><input name="txtStreet" type="text" id="txtStreet" value="<? echo $result['password'];?>" />
        </td>
</tr>
  <tr>
<td bgcolor="#FF9900">Gender</td>
<td bgcolor="#FFCC66">

<select name="selCity">
<?
require('config.php');
$myConn = mysql_connect($hostname_library, $username_library, $password_library) or die(mysql_error());
mysql_select_db($database_library);
if (!$myConn)die('Could not connectooo:' . mysql_error());

$query= "SELECT distinct(gender) FROM user";
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
?>
<option value = "<? echo $row['gender'];?>" <? if($row[ 'gender']==$city){ echo "selected"; } ?> > <? echo $row['gender'];?>
    </option>
<?

}

echo $result;
mysql_free_result($result); // เมื่อ process เสร็จแล้วให้ free result set ด้วย
mysql_close($mycon); // ปิด connection กับ MySQL Server
?>
</select>

</form>
<input type="submit" name="submit" id="submit" value="Update" />
</td>
<a href="index.php"><input type="button" name="button" id="button" value="Back" /></a>

</tr>
</form>
</body>
</html>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น