...

View Full Version : keyword search button



joonstar
04-12-2003, 09:57 PM
I am a beginner of PHP.
But someone who worked before me in my position have made
the Data base(mysql) and PHP programing.

I am just modifying the codes he made without any help from him.

I modified whole of the site in HTML for the site(I am skilled at HTML).
I modified large part of the PHP(with reading books).
I modified DB little.

Although I didn't made the search box, the search box works well
without any delay at the moment.


Next is the code he made, and simplified by me.


<FORM name=search action="SearchList.php" method="POST">

<select name=item>
<option value="0">total</option>
<option value="1">children</option>
<option value="2">female</option>
<option value="3">male</option>
</select>

<input type="text" name="item="14" maxlength=20>&nbsp;<input type=image src="/gif/search.gif" align="absmiddle">&nbsp;

</FORM>



Anyway, the search box works well.

For example,
if you enter "toy" in the search box and click the search button next to the search box,

The page will show the outcome of the search listing the all threads including the word "toy".

This is an usual search box. so far.
We can see these kinds of search boxes everywhere.

Now I want something I've never seen, but I think it's not difficult.

Dut to the key word "toy" is one of the most frequently searched word, I like to make the button "toy" just under the search box.
before the ending FORM tag </FORM>.

So if a user want to search the word "toy",
He can just click the button "toy" instead of entering the word "toy" in the search box.



Can you help me?
or
Any suggestion?

Nightfire
04-12-2003, 11:16 PM
Adding <input type="button" value="toy"> might do it, but without seeing the script(s), it's a bit like hunting in the dark

joonstar
04-23-2003, 09:15 AM
<FORM name=search action="SearchList.php" method="POST">

<select name=item>
<option value="0">total</option>
<option value="1">children</option>
<option value="2">female</option>
<option value="3">male</option>
</select>

<input type="text" name="item" size="14" maxlength=20> <input type="button" value=find>

</FORM>

Above is the search box.


I made next script for keyword search.

<a href="SearchList.php?item=toy">toy</a>


The above script I made does work. but not completely.

It shows all lists that are in the database.

I like to show the specified lists that have the word "toy".

missing-score
04-23-2003, 11:52 AM
Right, the reason that wont work is beacause you are using

blah.php?item=toy

This GET, not POST. In your form, it says action="post", meaning that the search script uses $_POST vars. You will need to change this in order for the link to work ($_GET).

If you just do what Nightfire said, it would work.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum