开发者

text submit form don't display the submitted text after being processed by php

开发者 https://www.devze.com 2023-04-05 09:49 出处:网络
i\'ve built a search engine + indexer script for a website using php and i know that this question may have a very simp开发者_运维知识库le solution but until now i couldn\'t figure it out, it took me

i've built a search engine + indexer script for a website using php and i know that this question may have a very simp开发者_运维知识库le solution but until now i couldn't figure it out, it took me less time to write the search engine than i wasted looking for answers to this on the web.

i have this form, people type and submit, the search engine script processes the input and gives out the results just fine

<form action="searchengine.php" method="get">
 <input id="searchbox" type="text" name="searchterm"><br><br>
 <input id="searchbutton" type="submit" value="Pesquisar">
</form>

the problem is that this form doesn't retain the searched string, after the search being performed the form is blank, the results are there but if the person wants to search for a similar thing, instead of correcting the previous search it has to type everything again.

any ideas to correct this problem ?


Implement it like this:

<form action="searchengine.php" method="get">
 <input id="searchbox" type="text" name="searchterm" value="<?php echo $_REQUEST["searchterm"] ?>"><br><br>
 <input id="searchbutton" type="submit" value="Pesquisar">
</form>
0

精彩评论

暂无评论...
验证码 换一张
取 消