我有一個由mysql數據庫填充的下拉菜單。我需要選擇一個,並在點擊提交之後發送信息以供下一頁使用。它確實填充下拉菜單,就像它應該看起來似乎無法捕獲下一頁上的數據。以下是我有:我有一個需要發送信息的PHP表單下拉菜單
removeMain.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<form action="remove.php" method="post">
<?php
$link = mysql_connect('********', '********', '*********');
if (!$link){
die('Could not connect: ' . mysql_error());
}
mysql_select_db("********", $link);
$res = mysql_query("SELECT * FROM cardLists order by cardID") or die(mysql_error());
echo "<select name = CardID>";
while($row=mysql_fetch_assoc($res)) {
echo "<option value=$row[ID]>$row[cardID]</a></option>";
}
echo "</select>";
?>
Amount to Remove: <input type="text" name="Remove" />
<input type="submit" />
</form>
<body>
</body>
</html>
remove.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<?php
$link = mysql_connect('*********', '*********', '*********');
if (!$link){
die('Could not connect: ' . mysql_error());
}
mysql_select_db("***********y", $link);
$query = sprintf("UPDATE cardLists SET AmountLeft = AmountLeft - %s WHERE cardID = '%s'", mysql_real_escape_string($_POST["Remove"]), mysql_real_escape_string($_POST["CardID"]));
mysql_query($query);
mysql_close($link);
?>
<br />
<a href="removeMain.php"> <input type="submit" name="return" id="return" value="Update More" /></a>
<a href="index.php"> <input type="submit" name="main" id="main" value="Return To Main" /></a>
</body>
</html>
此外,它用來工作時,這只是一個用戶輸入文本框,但如果他們可以選擇自己用的下拉菜單 – shinjuo 2010-03-23 20:00:23