我有2页sell.php和sell_form.php.当用户从sell_form.php的下拉菜单中选择股票代码时,我在sell.php中有一个查询,该查询应该从数据库中删除该股票代码,但我现在得到的只是一个空白页面我点击卖出按钮.我不确定我是否完全理解下拉菜单中的值如何传递给sell.php表单.这是我到目前为止的代码
这是我的sell.php文件
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
// delete the stock from their portfolio
query("DELETE FROM shares WHERE id = ? AND symbol = ?", $_SESSION["id"],$_POST["symbol"]);
redirect("/");
}
else
{
$rows = query("SELECT * FROM shares WHERE id = ?", $_SESSION["id"]);
//create array to store the shares
$shares = [];
//for each of the user info
foreach($rows as $row){
//lookup stock info
$stock = lookup($row["symbol"]);
if($stock !== false){
$shares[] = [
"name" => $stock["name"],
"price" => $stock["price"],
"shares" => $row["shares"], …Run Code Online (Sandbox Code Playgroud)