Adding Search Box to my website

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
xtremetab
Forum Newbie
Posts: 3
Joined: Sun Jun 14, 2009 12:48 am

Adding Search Box to my website

Post by xtremetab »

I am working on my website and have a question about a PHP search box.

On my songlist.php page I would like to print the name of the band above the list of songs. Any suggestions on the code?

I would also like to have a search box working at the top of the page where if someone typed the name of the band it would bring them right to the songlist.php of that band.

Take a look at the link below to see what I have so far.

http://www.xtremetab.com/tablature-tab-list-0.php

Any suggestions you have would be great.

Thanks
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Adding Search Box to my website

Post by McInfo »

It looks like your search form is currently

Code: Select all

<form method="post">
    <input type="text" name="Text1" />
</form>
If you change it to

Code: Select all

<form method="get" action="songlist.php">
    <input type="text" name="bandname" />
</form>
it should bring up the song list for the searched-for artist. If the artist is not found, the song list is blank, so you might want to do something different when the search fails, like redirect to the tablature-tab-list-X.php page where X is the first letter of the search term.

Without seeing the PHP scripts, there isn't much I can suggest at this point regarding your other questions.

Edit: This post was recovered from search engine cache.
Post Reply