Making a search function

Discussion in 'HTML & Website Design' started by Mr.tyro, Aug 18, 2007.

  1. #1
    Hello i am fairly new to css and html but i can pull my wait ish and i was wondering how would i make the search bar work on my site, i can make it so that you type a search term in there and click go but how do you make it function and search pages on my site?
     
    Mr.tyro, Aug 18, 2007 IP
  2. sportiana

    sportiana Peon

    Messages:
    248
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <html>
    <body>
    <table cellspacing=8>
    <SCRIPT language="JavaScript">
    function goGoogle(term){
    var siteURL = "yoursite.com ";
    var googURL = "http://www.google.com/search?q=site:" +
    siteURL + term;
    window.location = googURL;}
    </SCRIPT>
    <tr><td><h2>Search</h2></td></tr><tr>
    <form>
    <td align=right><input type=text name="theSearch"
    size=40></td></tr>
    <tr><td align=right>
    <input type=button value="Search"
    onClick='goGoogle(theSearch.value);'>
    </form>
    </td></tr>
    </table>
    </body>
    </html>

    Change yoursite.com with your site's domain name. You can also change <h2>Search<2> and button value="Search" with the text you want.
     
    sportiana, Aug 18, 2007 IP
  3. Mr.tyro

    Mr.tyro Guest

    Messages:
    525
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So this would be on goggle if i searched it?

    How would i make a search function that woudl allow me to search my site with out leaving to Google like any other normal site

    I got this tutorial it looks fine but how do i do the php i have no experience in it. http://www.dot-silver.co.uk/index.php?id=8

    Do i copy and paste all of the code showed or just the last part and save it as a .search.php?
     
    Mr.tyro, Aug 18, 2007 IP
  4. Mooseman

    Mooseman Peon

    Messages:
    453
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ^^ Theres plenty of other mysql/php search function tutorials, that will teach you do to more advanced search functions.

    You should learn some basic php/mysql first though, it will make it so much easier for you.
     
    Mooseman, Aug 18, 2007 IP
  5. tennisplayer89

    tennisplayer89 Peon

    Messages:
    387
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    tennisplayer89, Aug 18, 2007 IP