|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Search
hi guys i have this code:
Code:
<tr> <td align="right"> <p class="searchlabel"> Search: </p> </td> <td> <form action="search2.php" method="get"> <input type="text" name="se" size="30" maxlength="30" value=""> <select name="second"> <option value="se" selected>Movies</option> <option value="ac" selected>Actors</option> </select> <input class="searchbutton" type="submit" value="Go!"> </form> </td> </tr> i want when i select Actors from Select menu and type some Actor like Nicolas Cage then i press Go! button to show me all movies with this actor or when i select movies from menu and type some movie like Ronin then i press Go! button to show me this movie i setup this search only for movies but for multiplay searches i don't know how, when search only for movies i use that: Code:
if ($_GET['se']) {
$se = $_GET['se'];
$result = mysql_query("SELECT movie_id, movie_title FROM movies WHERE movie_title LIKE '%$se%'") or die ("Search query failed!");
any idea how i can do that ? thanks in advanced |
|
#2
|
|||
|
|||
|
Those are two different queries, so you need to have an if statement based on the value of your "second" form item.
PHP Code:
Is that what you need to know? |
|
#3
|
|||
|
|||
|
i think yes but i'm not really sure i wrote this:
PHP Code:
that is from search when i select for actors http://80.8.144.38/search3.php?se=nicolas&second=ac or for movies will be: http://80.8.144.38/search3.php?se=ronin&second=se but don't work any idea where i'm wrong ? |
|
#4
|
|||
|
|||
|
Check those $_GET['vars'] before using them in your queries. Also, no need to use a comparison on the get's - comparisons are slow - use a switch instead ->
PHP Code:
Default in the switch would be if nothing was chosen on the form for the narrowed results...
__________________
~ Joe Penn We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set? Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Search |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|