Php 对此错误的任何建议:注意:未定义索引:id
这是我在遵循你的一些建议后更新的代码,我已经丢失了那个错误,但是现在我的表单没有输出帖子,对此有什么建议吗Php 对此错误的任何建议:注意:未定义索引:id,php,forms,get,Php,Forms,Get,这是我在遵循你的一些建议后更新的代码,我已经丢失了那个错误,但是现在我的表单没有输出帖子,对此有什么建议吗 <form method="get" action="wavy.php"> <textarea name="postbody" rows="8" cols="80"></textarea> <input type="submit" value="submit" /> </form> <?ph
<form method="get" action="wavy.php">
<textarea name="postbody" rows="8" cols="80"></textarea>
<input type="submit" value="submit" />
</form>
<?php
include("connect.php");
$userid = "";
$username = "";
$id = "";
if(isset($_GET['postbody']))
{
if(isset($_GET['id']))
{
if (connect::query('SELECT id FROM accounts')) {
$userid = connect::query('SELECT id FROM accounts', array(':id'=>$_GET['id']))[0]['id'];
$postbody = $_GET['postbody'];
connect::query('INSERT INTO posts VALUES (null, :postbody, NOW(), :userid, 0)', array(':postbody'=>$postbody, ':userid'=>$userid));
}
$dbposts = connect::query('SELECT * FROM posts ORDER BY id DESC', array(':userid'=>$userid));
$posts = "";
foreach($dbposts as $p) {
$posts .= htmlspecialchars($p['body'])."
<form action='wavy.php' method='get'>
<input type='submit' name='like' value='Like'>
</form>
<hr /></br />
";
}
}
}
if(isset($postbody))
{
echo $postbody;
}
?>
是的=>是这个的复制品。提示:非常仔细地看你的第二张表格的行为可能是的复制品,这似乎是你的另一个问题的复述@Xorifelse我想他们还没有得到“它”。