Results 1 to 4 of 4

Thread: hi - search script that has a special function!

  1. #1
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking hi - search script that has a special function!

    Hi, this is my first post, and i hope not to be rude by joining.
    For my website, all of the other pages have codes, from 0000 to 9999. i want a search script that if you enter in one of these codes in the search box, it will automaticly take you to that page. A bit like teletext. I cannot reveal too much, dont want others stealing my idea.
    Also, if possible, if the user were to enter in "spare car parts" then it would just perform a normal search.

    Also, I LOVE DYNAMICDRIVE, BEST CODE SITE EVER.

    Thanks,
    Kevin

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you want help with the script, you'll probably need to tell us more. Or keep it a secret and write the script yourself.

    From what you describe, that isn't a search function at all.

    It's fairly simple, really.

    Just type in the number, send it to a PHP script, then redirect to the right page, based on the code.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Thanks for the speedy reply!
    also, i dont need help with a script,
    i just want one where you enter in a code, and then it takes you to an external website.
    The reason being that it is for mobiles and it is quicker.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    <form onSubmit="window.location='http://theother.com/dir/'.this.elements.numfield.value.'.htm'; return false;">
    <input type="text" name="numfield">
    <input type="submit">
    </form>

    That uses javascript, though.

    to be safe for other browsers, you might want to add PHP to it as well.

    Same as above, but add action="nextpage.php" method="get" to the form tag.

    On nextpage.php, use the following code:
    <?php
    header("Location: http://theother.com/dir/".$_GET['numfield'].".htm");
    echo "You are being redirected to the next page";
    ?>

    That should work, with a little modification, at least.


    Note that there is no error checking in this, so if they enter an incorrect value, they will get a 404 on the redirect. You could, I suppose, use a dropdown menu for this, if that would help the user know what to enter, though it would be awkward with thousands of numbers.
    Last edited by djr33; 06-13-2007 at 07:07 PM.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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