maxves1 Posted April 5, 2010 Share Posted April 5, 2010 Hello , Can anyone help me with displaying results of my php onto another page? Heres the code I wrote for search category and it works fine : <?php include ('db_connect.php'); // DATABASE CONNECTION ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="refresh" content="180; url=http://faculty.poly.edu/~yjeanpie/searchcat.php"> <SCRIPT language=JavaScript> function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='searchcat.php?cat=' + val ; } </script> <script Language="JavaScript"> <!-- function confirm_dropdown() { if (f1.cat.options.selectedIndex == 0) { alert("Please select the Category."); f1.cat.focus(); return (false); } if (f1.subcat.options.selectedIndex == 0) { alert("Please select the Products."); f1.subcat.focus(); return (false); } return (true); } //--></script> <script language=" JavaScript" ><!-- function MyReload() { window.location.reload(); } //--></script> </head> <body onLoad=" MyReload()"> <center> <p> </p> <p> </p> <p> </p> <div><center> <hr align="center" size="1" width="550" color="#99CCFF"> <hr align="center" size="1" width="550" color="#99CCFF"> <p><img src="fitl reslogo.jpg" width="223" height="67"></p> <p><font face="Arial, Helvetica, sans-serif" size="2" align="Left">Search by Category</font></p> <div align="center"> <? @$cat=$_GET['cat']; if(strlen($cat) > 0 and !is_numeric($cat)){ echo "Data Error"; exit; } $quer2=mysql_query("SELECT DISTINCT category,cat_id FROM category order by category"); if(isset($cat) and strlen($cat) > 0){ $quer=mysql_query("SELECT DISTINCT prod_name FROM PRODUCTS where cat_id=$cat order by prod_name"); } echo '<form method=post name=f1 action="dd-check1.php" onsubmit="return confirm_dropdown()">'; echo "<select name='cat' onchange=\"reload(this.form)\"><option value='' style= width:13em;>Select category</option>"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['cat_id']==@$cat){echo "<option selected value='$noticia2[cat_id]'>$noticia2[category]</option>"."<BR>";} else{echo "<option value='$noticia2[cat_id]'>$noticia2[category]</option>";} } echo "</select>"; echo "<br>"; echo "<br>"; echo "<select name='subcat' style= width:15em;><option value=''>Select products</option>"; while($noticia = mysql_fetch_array($quer)) { echo "<option value='$noticia[prod_name]'>$noticia[prod_name]</option>"; } echo "</select>"; echo "<br>"; echo "<br>"; echo '<input type=image src="back.jpg" srcname=btnback id=btnback onclick="history.go(-1);return false;"/>'; echo '<span style="padding-left:10px">'; echo '<input type=image src="button.JPG" >'; echo '</span>'; echo "</form>"; ?> </div></center> <br> <hr align="center" size="1" width="550" color="#99CCFF"> <hr align="center" size="1" width="550" color="#99CCFF"> </div></center> </div> </center> </body></html> Now I saved this file onto my database as searchcat.php you can check the link at: http://faculty.poly.edu/~yjeanpie/searchcat.php only problem is upon submission ,I want it to display results onto a new page "dd-check1" in this case, in such a way, that it displays the category and product selected and along with it, it displays relevant information related with the specific product for the category selected, like say for example "if i select software and photoshop " I want it to show that on the other page along with the tutorial links i have in database and other relevant info " My databse PRODUCTS looks like the file attached ( from where i want to retrieve other relevant results" PLEASE HELP ME ASAP , i need to get this done within 2 weeks any help will be honestly appreciated [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/197653-help-with-displaying-selected-dropdown-menu-on-another-page-with-related-queries/ 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.