我做错了什么?然后 我永远不会得到"好的"。
我曾尝试过其他包含太多HTML的代码,而且无法很好地清理它以适合我。我的麻烦似乎是形式领域缺乏能力。
<?php
include "connect.php";
session_start();
if (isset($_SESSION['username']))
{
print "<A href='addquote.php'>Add a quote</a> | <A href='deletequote.php'>Delete a quote</a> | <A href='search.php'>Search</a><br><br>";
if(isset($add))
{
print "OK";
$addquote="Insert into rquote_quotes (quote) values ('$add')";
$result=mysql_query($addquote) or die("Could not insert quote");
if($result)
{
print "Quote added successfully";
}
else
{
print "ERROR";
}
}
else
{
print "<form action='addquote.php' method='post'>";
print "Type quote here<br>";
print "<textarea name='quote' rows='3' cols='20'></textarea><br>";
print "<input type='submit' name='add' value='add quote'></form>";
}
}
else
{
print "Not logged in as Administrator, please <A href='login.php'>Login</a>";
}
?>
答案 0 :(得分:1)
您需要更改:
if(isset($add))
到此:
if(isset($_POST['add']))