无法接收代码

时间:2014-05-17 05:37:05

标签: javascript php html mysql

嘿家伙很抱歉问这个,但是我很难过,我希望代码在单击单选按钮时转到带有操作的页面,就像愚蠢的单选按钮到stupid.php这里的表单

 <form name = "quoted" 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)

尝试将表单action = "stupidweb3.php"移至action = "stupidweb3.php" 还要检查单选按钮代码(保留唯一ID并删除操作)

<form name = "quoted"  action = "stupidweb3.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" id="x" value="stupid" />    <span>stupid</span></label><br>
    <label for="x"><input type="radio" name="x" id="x1" value="stupider" /> <span>stupider</span>    </label><br>
    <label for="x"><input type="radio" name="x" id="x2" value="stupidest"  />    <span>stupidest</span></label>
  </div>
  <input id = "submit1" type="submit"><br>
 </form>

和stupidweb3.php

<div class="wrapper">
    <div class="submissions">
    <div class="logo-logo"><h2>Question.</h2>
    <div class="checkboxes"><?php echo (!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>

</div>
</div>

以及运行查询的位置以及设置$actual_quote, $poster的位置,它应该像

<?php 
$sql = "INSERT INTO submissions(top-submit, poster)
 VALUES ('$actual_quote', '$poster')";
?>

设置两个变量并运行查询