Ben kodu ve şimdi sayfa yükleri ve her şey düzenlenmiş, fakat veritabanına eklemek değildir:
<body>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
require("serverInfo.php");
mysql_query("UPDATE `cardLists` SET `AmountLeft` = `AmountLeft` + ".mysql_real_escape_string($_POST['Add'])." WHERE `cardID` = '".mysql_real_escape_string($_POST['Cards'])."'");
echo "\"" .$_POST['Add'] ."\" has been added to the inventory amount for the card \"". $_POST['Cards']. "\"";
mysql_query("INSERT INTO `log` (`changes`, `amount`, `cardID`, `person`, `date`)VALUES('ADDED',".mysql_real_escape_string($_POST['Add']).",
".mysql_real_escape_string($_POST['Cards']).",".mysql_real_escape_string($_POST['Person']).", NOW())") or die (mysql_error());
mysql_close($link);
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<?php require("serverInfo.php"); ?>
<?php
$res = mysql_query("SELECT * FROM cardLists order by cardID") or die(mysql_error());
echo "<select name = 'Cards'>";
while($row=mysql_fetch_assoc($res)) {
echo "<option value=\"$row[cardID]\">$row[cardID]</option>";
}
echo "</select>";
?>
Amount to Add: <input type="text" name="Add" maxlength="8" />
Changes Made By: <select name="Person">
<option value="justin">Justin</option>
<option value="chris">Chris</option>
<option value="matt">Matt</option>
<option value="dan">Dan</option>
<option value="tim">Tim</option>
<option value="amanda">Amanda</option>
</select>
<input type="submit" name ="submit" onClick= "return confirm(
'Are you sure you want to add this amount?');">
</form>
<br />
<input type="button" name="main" value="Return To Main" onclick="window.location.href='index.php';" />
</body>
</html>