-1
你能告訴我爲什麼說actual_quote和海報是不明身份的索引嗎?我一直在爲此掙扎一個小時。Php身份不明的索引
繼承人在那裏,他們得到的值
<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>
<div class="wrapper">
<div class="submissions">
<div class="logo-logo"><h2>Quotr.</h2>
<div class="checkboxes"><?= !empty($_GET['x']) ? $_GET['x'] : '' ?>
</div>
</div>
然後這裏的地方PHP是抓住了值和網頁上顯示它們的形式,在都顯示此錯誤
Notice: Undefined index: actual_quote in the index of the file on line 47
Call Stack
Time Memory Function
1 0.0004 254200 {main}()
,反之亦然海報
<div class="top-submit"><?php echo '“' . (!empty($_GET['actual_quote']) ? $_GET['actual_quote'] : '') . '”'; $actual_quote = isset($_GET['actual_quote']) ?: false;?>
</div>
<div class="poster"><?php echo "-" . (!empty($_GET['poster']) ? $_GET['poster'] :''); $poster = $_GET['poster']; $poster = isset($_GET['poster']) ?: false;?>
<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>
請幫忙!我很難過。 由於提前, -Connor
首先檢查isset http://in2.php.net/isset然後檢查它是否爲空 – Prashank
是第二個文件question.php? – anthonygore
按原樣運行此代碼不會產生該錯誤。你能提供完整的代碼嗎?此外,您的表單中有無效的屬性。表單標籤中的「form」,輸入標籤中的「action」無效,什麼也不做。你能在這裏進一步解釋你的意圖嗎? – anthonygore