身份不明的索引问题

时间:2014-05-17 07:54:39

标签: php html

为什么将此注册为错误,当我尝试$ _GET actual_quote和poster时,它会返回此信息。 注意:未定义索引:第47行文件索引中的actual_quote 调用堆栈     时间记忆功能位置 1 0.0004 254200 {main}().. \ stupid.php:0

$ _GET actual_quote在第47行,它对海报说的是相同的,请帮助我陷入困境。

    <form name = "quoted" form action = "question.php" method="get">
    <input id = "poster" type="text" name="poster" required="required" placeholder = "Credited Individual.">     
    <br>
    <textarea class = "actual_quote" name = "actual_quote" required="required" placeholder = "Write the question here!"></textarea>
    <br><br><br>

    <div class = "checkboxes" required="required">
        <h3 style = "margin-top:-20px;">Please select one catagory that the quote falls into.</h3>
        <label for="x"><input type="radio" name="x" value="stupid" id = "x" checked="checked" action = "stupid.php" /><span>stupid</span></label>
        <br>
        <label for="x"><input type="radio" name="x" value="stupider" id = "x" action = "stupider.php" /><span>stupider</span></label>
        <br>
        <label for="x"><input type="radio" name="x" value="stupidest" id = "x" action = "stupidest.php" /><span>stupidest</span></label>
    </div>

    <input id = "submit1" type="submit"><br>
 </form>

这里是每个页面上的php,愚蠢,愚蠢和愚蠢,php错误是说实际报价和海报不是识别索引,帮忙吗?

    <div class="wrapper">
    <div class="submissions">
    <div class="logo-logo"><h2>Question.</h2>
    <div class="checkboxes"><?= !empty($_GET['x']) ? $_GET['x'] : '' ?>
    </div>

    </div>

 <div class="top-submit"><?php echo '&#8220;' . (!empty($_GET['actual_quote']) ?  $_GET['actual_quote'] : '') . '&#8221;'; $actual_quote = $_GET['actual_quote'];?>
 </div>
 <div class="poster"><?php echo "-" .  (!empty($_GET['poster']) ? $_GET['poster'] :''); $poster =  $_GET['poster'];?>
 <div class = "like">
 <a href = "javascript:countClicksLike();" class = "btn btn-large" style = "color:green;">Like</a>
 <p id = "like" style = "color:green;">0</p>
 </div>
 <div class = "dislike">
 <a href = "javascript:countClicks();" class = "btn btn-large" style = "float:right; color:red;">Dislike</a>
 <p id = "dis" style = "color:red;">0</p>
 </div>
  </div>
 <?php 
 "INSERT INTO submissions(top-submit, poster)
 VALUES ($actual_quote, $poster)";
?>
</div>
</div>

1 个答案:

答案 0 :(得分:0)

你也需要对你的作业进行三元化:

$actual_quote = isset($_GET['actual_quote']) ?: false;