php 提交没反映

来源:百度知道 编辑:UC知道 时间:2024/06/17 04:46:44
我输入后,提交,数据库里没有任何反映.请高手帮忙看看,修改下.谢谢
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<body>

<form action="<?=$_SERVER['php_self'] ?>" method="GET">
<?include ("header.php") ?>
<table>

<h1>输入新图书信息</h1><font><br />
<? if (isset($status)){?>
<tr><td colspan="2"><b><?=$status?></b><br><br></td></tr>
<? } ?>

<tr><td>ISBN:</td><td><input type="text" name="ISB

$conn=$sql="INSERT INTO artist(name,bio,ISBN,press)".
"VALUES('{$name}','{$bio}','{$ISBN}','{$press}')";
mysql_connect("localhost","root","1123")
or die(mysql_error());
字符串中的变量是要用{}给括起来的。当然,如果如果字段类型是int的话,直接{$var}即可。

明显是全局变量的问题。form method=GET,那么所有提交的变量需要用$_GET[""]来表示,如$_GET["name"],$_GET["bio"].这取决regist_global的设置,现在的PHP默认都是off,所以必须用以上方式,如果是POST,那么用$_POST[""]

至于用{},在SQL里,一般二维数组才用的上。如{$_SESSION[USER][userid]}