<head>
<title>Admin Page</title>
<?php require_once( 'raw_connect.php');
$sql="SELECT * FROM clients" ;
$result=m ysqli_query($conn,$sql) or die(mysqli_error($conn));
?>
</head>
<body>
<form action='project.php' method=post>
Client Name:
<Select name="existing">
<option value=1>Select a Client</option>
<?php while($row=m ysqli_fetch_array($result)) echo "<option value=".$row[ 'ClientNo']. ">" . $row[ 'ClientName'] . "</option>"; ?>
</Select>
<br>Project Name:
<input type=text name=projectname>
<input type=submit value='Create Project'>
</form>
</body>
所以我有这个表单,它显示客户端的选择框和项目的文本框。我的问题是每当我尝试处理它时,我得到错误“致命错误:数组回调必须包含索引0和1” 页面本身显示完美,只有当我点击提交错误发生在下一页时才会显示。
在做了一个检查元素之后我得到了这个:
"<form action="project.php" method="post">
Client Name: <select name="existing">
<option value="1">Select a Client</option>
<option value="5">fred</option><option value="7">louise</option><option value="8">ben</option> </select>
<br>
Project Name: <input type="text" name="projectname">
<input type="submit" value="Create Project">
</form>"
project.php是: `
require_once('raw_connect.php');
$person= $_POST["existing"];
$projectname= $_POST('projectname');
$sql="SELECT * FROM Clients WHERE ClientNo='$person'";
$result=mysqli_query($conn, $sql);
echo($projectname);
?>`