File: C:/xampp/htdocs/ACProof/admin/edit.php
<?php
/*
All source code copyright and proprietary Melonfire, 2002. All content, brand names and trademarks copyright and proprietary Melonfire, 2002. All rights reserved. Copyright infringement is a violation of law.
This source code is provided with NO WARRANTY WHATSOEVER. It is produced and meant for illustrative purposes only, and is NOT recommended for use in production environments.
Read more articles like this one at http://www.melonfire.com/community/columns/trog/ and http://www.melonfire.com/
*/
// edit.php - edit a press release
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<!-- standard page header begins -->
<p> <p>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="Navy"><font size="-1" color="White"><b>>基本資料作業: Edit <?php print $barcode;?></b></font></td>
</tr>
</table>
<!-- standard page header ends -->
<p>
<?php
// includes
if (!isset($submit))
{
$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db="fograproof";
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
//$link = mssql_connect("MACBOOK7", "sa", "fred5697");
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT * from ACdevice where id='$id'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if a result is returned
while($row = mysql_fetch_object($result))
{
?>
<table cellspacing="5" cellpadding="5">
<form action=" <?php echo $PHP_SELF; ?>" method="POST">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<tr>
<td valign="top"><b><font size="-1">類別:</font></b></td>
<td><?php if ($row->type=='pr') { echo "繪圖機"; } else { echo "紙張";} ?></td>
</tr>
<tr>
<td valign="top"><font size="-1">型號:</font></td>
<td><input size="50" maxlength="250" type="text" name="ddes" value="<?php print $row->ddes; ?>"></td>
</tr>
<tr>
<td colspan=2><input type="Submit" name="submit" value="Update"></td>
</tr>
</form>
</table>
<?php
}
}
// form submitted
// start processing it
else
{
$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db="fograproof";
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
//$link = mssql_connect("MACBOOK7", "sa", "fred5697");
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "UPDATE ACdevice
SET ddes='$ddes' WHERE id='$id'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// print result
echo "<font size=-1>Update successful. <a href=list.php>Go back to the main menu</a>.</font>";
echo "<br><br><font size=-1>Update successful. <a href=../ACindex.php>Home</a>.</font>";
// close database connection
mysql_close($connection);
}
?>
<!-- standard page footer begins -->
<p>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
</tr>
</table>
<!-- standard page footer ends -->
</body>
</html>