任何人都可以解释我的错误吗? 这是表格,位于名为genericwebpage.html的网页上
<form name = "quoted" form action = "genericwebpage.php" method="get">
<input id = "poster" type="text" name="poster" placeholder = "Credited Individual."> <br>
<textarea class = "actual-quote" name = "actual-quote"placeholder = "Write the quote here!"></textarea><br><br>
<input id = "submit1" type="submit">
</form>
和继承人php,在genericwebpage.php上找到
<div class="wrapper">
<div class="submissions">
<div class="logo-logo"><h2>Generic.</h2></div>
<div class="top-submit"><?php echo $_GET['actual-quote']?></div>
<div class="poster"><?php echo $_GET['poster']?></div>
</div>
有人可以指导我在正确的方向上解决这个问题,我看到很多人使用isset但我不知道这是否适用于这种情况?
答案 0 :(得分:1)
在textarea的名称和占位符之间放置至少一个空格。
答案 1 :(得分:1)
PHP显示&#34;实际引用&#34;没有收到。这是因为你在namefield之后遗漏了一个空格。复制并粘贴它,这是正确的:
<form name = "quoted" form action = "genericwebpage.php" method="get">
<input id = "poster" type="text" name="poster" placeholder = "Credited Individual."> <br>
<textarea class = "actual-quote" name = "actual-quote" placeholder = "Write the quote here!"></textarea><br><br>
<input id = "submit1" type="submit">
</form>
答案 2 :(得分:0)
尝试使用isset()
或empty()
来检查值是否为空以避免php通知还在表单字段中的每个attr(占位符/名称)之间使用空格
<form name = "quoted" form action = "genericwebpage.php" method="get">
<input id = "poster" type="text" name="poster" placeholder = "Credited Individual."> <br>
<textarea class = "actual-quote" name = "actual-quote" placeholder = "Write the quote here!"></textarea><br><br>
<input id = "submit1" type="submit">
</form>
PHP
<div class="wrapper">
<div class="submissions">
<div class="logo-logo"><h2>Generic.</h2></div>
<div class="top-submit"><?php echo (!empty($_GET['actual-quote']) ? $_GET['actual-quote'] : '');?></div>
<div class="poster"><?php echo (!empty($_GET['poster']) ? $_GET['poster'] :'');?></div>
</div>