Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Seoul, Korea
    Posts
    329
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Frequently Searched Word

    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?
    Last edited by joonstar; 04-12-2003 at 10:14 PM.

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Adding <input type="button" value="toy"> might do it, but without seeing the script(s), it's a bit like hunting in the dark

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Seoul, Korea
    Posts
    329
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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".

  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •