English 中文(简体)
点击搜索按钮后如何显示搜索细节?
原标题:How to display search details after search button is clicked?

我有一个模式窗口, 它包含一个文本框和一个搜索按钮。 现在我要的是当用户在一个单词中输入然后单击“ 搜索” 按钮时, 我要它运行查询并显示结果, 并显示结果是否为结果 。

问题在于我不知道如何在“ 搜索” 按钮被粘贴后, 如何让该按钮输出该“ 搜索” 细节 。 目前, 如果用户在输入一个字后点击“ 搜索” 按钮, 则不会发生任何事情 。

所以我只需要一个与“ 搜索” 按钮相关的正常函数, 这样它就可以在点击搜索按钮后输出细节 。 如何做到这一点?

这里是""的链接 http://heliss.hud.ac.uk/u08677587/Mobile_app/QandATable2.php" rel = “nofollow” > application , 这样您就可以看到正在发生的事情 。

以下是完整的代码:

<div class="previouslink">

<button type="button" id="close" onclick="return closewindow();">Close</button>
<h1>PREVIOUS QUESTIONS</h1>

<?php

      foreach (array( questioncontent ) as $varname) {
        $questioncontent = (isset($_POST[$varname])) ? $_POST[$varname] :   ;
      }

?>

<form action="<?php echo htmlentities($_SERVER[ PHP_SELF ]); ?>" method="post">
      <p>Search: <input type="text" name="questioncontent" value="<?php echo $questioncontent; ?>" /></p>
      <p><input id="searchquestion" name="searchQuestion" type="submit" value="Search" /></p>
      </form>

<?php

            if (isset($_POST[ searchQuestion ])) {

              $questionquery = "SELECT QuestionContent FROM Question
          WHERE(QuestionContent =  ".mysql_real_escape_string($questioncontent)." )";

      $questionnum = mysql_num_rows($questionresult = mysql_query($questionquery));
      ?>

     <p>
         Your Search: <?php echo " $questioncontent "; ?>
     </p>


      <?php
        if($questionnum ==0){
    echo "<p>Number of Questions Shown from the Search: <strong>$questionnum</strong></p>";
    echo "<p>Sorry, No Questions were found from this Search</p>";}
    else{
        echo"<p>Number of Questions Shown from the Search: <strong>$num</strong></p>";

      $output = "";
$output .= "
    <table border= 1 >
      <tr>
      <th>Question</th>
      </tr>
";
        while ($questionrow = mysql_fetch_array($questionresult)) {
$output .= "
      <tr>
      <td>{$questionrow[ QuestionContent ]}</td>
      </tr>";
        }
        $output .= "        </table>";

        echo $output;

  }

  if (empty($questioncontent)){
    echo "Please enter in a phrase in the text box in able to search for a question";
}

}

  mysql_close();

?>

</div>

最新节目:

<body>

                <?php

               if (isset($_POST[ searchQuestion ])) {

                    echo "xxx";

                exit;

               }
?>

<form id="QandA" action="imageupload.php" method="post">

<h1>CREATING QUESTIONS AND ANSWERS</h1>

<table id="plus" align="center">
<tr>
<th>
<a onclick="return plusbutton();">
<img src="Images/plussign.jpg" width="30" height="30" alt="Look Up Previous Question" class="plusimage"/>
</a>
<span id="plussignmsg">(Click Plus Sign to look <br/> up Previous Questions)</span>
</th>
</tr>
</table>

<div class="previouslink">

<button type="button" id="close" onclick="return closewindow();">Close</button>
<h1>PREVIOUS QUESTIONS</h1>

<form action="<?php echo htmlentities($_SERVER[ PHP_SELF ]); ?>" method="post">
      <p>Search: <input type="text" name="questioncontent" /></p>
      <p><input id="searchquestion" name="searchQuestion" type="submit" value="Search" /></p>
      </form>





</div>

</form> 

</body>
最佳回答

尝试调试您在点击按键搜索时得到的内容, 请查看您的查询列表,

当没有窗体时, 没有动作, 所以在点击搜索时不会发生任何事情 使用正确的代码格式化

问题回答

您应该将输入标记移动到 块内 。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签