swatisonee Posted May 11, 2010 Share Posted May 11, 2010 Heres what i wish to do: a . Select a variable, say, country from a list of 200+ by typing the first few alphabets (say Bel ). This will throw up Belgium.Belize etc. b. Select say, Belgium and then the list of cities there will pop up. c. From that citylist, a selection will be made to pick out say, hotels. The form will then get populated by other data that the user will enter. d. The data for all 3 selections are in 3 separate tables linked with a common variable Table A : CID,Co Table B, CID, Cityid, City Table C : CID,Cityid, HID, Hotel I have the foll code to make the search but am not abole to put all of it in a single page . Here's what i have so far : Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/ Share on other sites More sharing options...
Adam Posted May 11, 2010 Share Posted May 11, 2010 ..? Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056270 Share on other sites More sharing options...
swatisonee Posted May 11, 2010 Author Share Posted May 11, 2010 OOPS ! Code didnt get posted in my earlier mail. <html> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=Generator content="Microsoft Word 11 (filtered)"> <title>REPORT</title> <? header("Cache-Control: public"); include ("../include/session.php"); // session start include ("../indl.php"); //db info for DB2 $userid = $_SESSION['userid']; // works if(!isset($_SESSION['userid'])){ echo "<center><font face='Calibri' size='2' color=red>Sorry, Please login and use this page </font></center>"; exit;} echo $userid; //works; if(isset($_POST) && !empty($_POST["co"])) { ?> <b><p><font face="Tahoma" size="2" color="#0000FF">These are the cos in your database in the selected range. Please choose one</b></font><p> <table border="1" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr bgcolor="#DEEDFE"> <form method="post" action="salesreport1.php?userid=<? echo $userid ?>"> <td><b><font size=2 face=Tahoma color=blue>Select</b></td> <td><b><font size=2 face=Tahoma color=blue>C</b></td> <td><b><font size=2 face=Tahoma color=blue>S</b></td> <td><b><font size=2 face=Tahoma color=blue>L/b></td> <tr> <? $sql = "SELECT * FROM TableA c INNER JOIN TableB v USING(CID) INNER JOIN TableC a USING(AID) INNER JOIN Cities t USING(CITYID)WHERE c.`Co` LIKE '%$co%' ORDER BY `Company` asc"; //If there is no data in Table B or C), then the query returns no values - ie i get a blank table. I therefore would like for this to work in a way that I can first select a record from Table A and then work on B&C in the same script $result = mysql_query($sql) or die (mysql_error ()); do { printf("<tr><td><input type=\"radio\" name=\"choice\" value=%d><td> <font size=2 face=Tahoma color=blue>%s<td> <font size=2 face=Tahoma color=blue>%s<td> <font size=2 face=Tahoma color=blue>%s<td> </tr>", $myrow["CID"], $myrow["Co"], $myrow["St"], $myrow["Lae"] ); } while ($myrow = mysql_fetch_array($result)); ?> </table> <p><input type="submit" value="Select"> </form> <?php } else { showForm(); } function showForm() { $userid = $_GET["userid"]; ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="userid" value="<? echo $userid ?>"> <font face="Tahoma" size="3" color="#0000FF">Type the first few alphabets of the company name and then select one to add a report.<P> <font face="Tahoma" size="2" color="#0000FF">Co:<input type="text" size="12" name="co"> <input type="submit" value="Go !"> </form> <?php } ?> //</body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056360 Share on other sites More sharing options...
sharp.mac Posted May 11, 2010 Share Posted May 11, 2010 something like this? http://www.javascriptkit.com/script/cut183.shtml for the auto suggest you might want to look into jquery or ajax. http://www.brandspankingnew.net/specials/ajax_autosuggest/ajax_autosuggest_autocomplete.html Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056362 Share on other sites More sharing options...
swatisonee Posted May 11, 2010 Author Share Posted May 11, 2010 hi. i need to first filter the data in Table A - Hence the search box. Then the dropdowns work Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056363 Share on other sites More sharing options...
swatisonee Posted May 11, 2010 Author Share Posted May 11, 2010 Also, I need the drop downs to fit into this html code - not serially one after another. So am also stuck on where to create a "break" in the code so that the data comes into the necessary spaces on the html file. <tr style='page-break-inside:avoid;height:12.95pt'> <td width=780 colspan=4 style='width:468.0pt;border:solid windowtext 1.0pt; border-top:none;padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'> <p class=MsoNormal><span lang=EN-US style='color:#000058'>Co: </span><select name=Dropdown1> <span lang=EN-US style='font-family:Calibri;color:#000058'> </a></span> </td> </tr> <tr style='page-break-inside:avoid;height:12.95pt'> <td width=780 colspan=4 style='width:468.0pt;border:solid windowtext 1.0pt; border-top:none;padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'> <p class=MsoNormal><span lang=EN-US style='color:#000058'>St: </span><select name=Dropdown2> </a></p> </td> </tr> <tr style='page-break-inside:avoid;height:12.95pt'> <td width=360 style='width:216.0pt;border:solid windowtext 1.0pt;border-top: none;padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'> <p class=MsoNormal><span lang=EN-US style='color:#000058'>City: </span><a name=Dropdown3></a></p> </td> <td width=180 colspan=2 style='width:108.0pt;border-top:none;border-left: none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'> <p class=MsoNormal><span lang=EN-US style='color:#000058'>Lae: </span><a name=Dropdown4></a></p> </td> <td width=240 style='width:144.0pt;border-top:none;border-left:none; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; padding:1.45pt 4.3pt 1.45pt 4.3pt;height:12.95pt'> <p class=MsoNormal><span lang=EN-US style='color:#000058'>Pin Code:</span><a name=Dropdown5></a></p> </td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056370 Share on other sites More sharing options...
Adam Posted May 11, 2010 Share Posted May 11, 2010 Sorry I'm a little confused, what exactly is your question? Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056371 Share on other sites More sharing options...
sharp.mac Posted May 11, 2010 Share Posted May 11, 2010 Also, I need the drop downs to fit into this html code - not serially one after another. So am also stuck on where to create a "break" in the code so that the data comes into the necessary spaces on the html file. That's a shark with a lot of teeth, you defiantly have some homework to do. I would also look into div's it would clean that table mess up quickly. Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056373 Share on other sites More sharing options...
swatisonee Posted May 11, 2010 Author Share Posted May 11, 2010 hi, true ! if there were a way i could just dump that html code into something which could give me the template i want and clean up the page, i would ! but 1st things 1st : I have to solve the php coding first. @MrAdam: Heres what i wish to do. The code I wrote works only if here is data in tables A,B&C. For example, if there is no hotel in Antwerp in Belgium, the entire row will return a null value so even Antwerp and Belgium dont show up. But if there is Hotel X then we get all 3 bits of info in the table Hotel X | Antwerp | Belgium. a . Select a variable, say, country from a list of 200+ by typing the first few alphabets (say Bel ). This will throw up Belgium.Belize etc. b. Select say, Belgium and then the list of cities there will pop up. c. From that citylist, a selection will be made to pick out say, hotels. The form will then get populated by other data that the user will enter. d. The data for all 3 selections are in 3 separate tables linked with a common variable Table A : CID,Co Table B, CID, Cityid, City Table C : CID,Cityid, HID, Hotel Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056455 Share on other sites More sharing options...
Adam Posted May 11, 2010 Share Posted May 11, 2010 @MrAdam: Heres what i wish to do. The code I wrote works only if here is data in tables A,B&C. For example, if there is no hotel in Antwerp in Belgium, the entire row will return a null value so even Antwerp and Belgium dont show up. But if there is Hotel X then we get all 3 bits of info in the table Hotel X | Antwerp | Belgium. That's not a question. Quote Link to comment https://forums.phpfreaks.com/topic/201324-combining-a-search-textbox-with-multiple-dropdowns/#findComment-1056458 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.