我不知道它是否是一个愚蠢的错误,但没有设置 post/get 变量,而它应该是。以下是 HTML 和 php 代码片段:
<html>
<head>
<title>
Chain Story
</title>
</head>
<body>
<form method="GET" action="check-valid.php">
<textarea name="a" rows="5" cols="50"></textarea>
<input type="submit" value="Add" />
</form>
</body>
</html>
检查-valid.php:
<?php
require 'includes/connect.inc.php';
$conn_ref = connect_db('chainstory') or die(mysqli_error());
if(isset($_GET)){
echo 'Get variable set';
if(isset ($_GET['a'])){
$as = $_GET['a'];
$query = "insert into story1 values (1, " . $as . ")";
mysql_query($query, $conn_ref);
}
else{
echo $_GET;
}}
?>
我得到以下输出:
Get variable set
Notice: Array to string conversion in /home/kevin/Code/php/myWebsite/check-valid.php on line 15
Array
我在netbeans中对此进行编码。谁能指出我犯了什么错误?:(