Jump to content

dawg1

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by dawg1

  1. So I figured out my problem with IE. Caching. To resolve the issue I added + escape(new Date()); to my var strURL. As for the minibasket replacing the parent div, it still does it. I think the issue is because the mini .hidden div is stacked inside the mini div... <div id="mini"> <div class="hidden"></div> </div>
  2. Ok, I believe I have resolved the JS errors. Now in IE the only mini div that loads says the cart is empty, but, again, works great in firefox, chrome, safari.
  3. Thanks for the advice. I put in the code and I am getting alerts, I'm not exactly sure where or what I need to fix.... function callback_fn () { var strURL="/TKMINI.html"; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { alert($('#mini').html()); document.getElementById('mini').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } I get the first alert (screenshot_1.png) after I add my first product. I get the second alert (screenshot_2.png) thereafter (for each product I add after the first, I get this same alert). So it appears that the div is not refreshing, or loading in the new products, after the first product is added. I can even go to my shopping cart (a different page on the website) clear the entire cart, go back to the product page, add a new (different) product, and the minibasket loads with the information of the very first product -which is no longer even in the basket. Any ideas??? [attachment deleted by admin]
  4. This works great in firefox, but in IE the div with refresh only 1 time. Any suggestions how to fix it so that continues to refresh?
  5. So far I've gotten this to work.. findCOURSE.php <select name="COURSE" onChange="get_Results(this.value)"> <option>Select Course</option> <?php require "config.php"; $CURR=$_GET['CURR']; $COURSE=$_GET['COURSE']; $query = "SELECT DISTINCT CURR, COURSE FROM UGASU11 WHERE CURR = '$CURR' order by COURSE"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { ?> <option value=<?php echo $row['CURR'],$row['COURSE']?>><?php echo $row['COURSE']?></option> <? } ?> </select> outputs... <select name="COURSE" onChange="get_Results(this.value)"> <option>Select Course</option> <option value=ADPR3110>3110</option> <option value=ADPR3520>3520</option> <option value=ADPR5910>5910</option> <option value=ADPR5990 H>5990 H</option> </select> which is what I need. But, I can't figure out the next step. This is the function that should submit to textbooks.php for the results (doesn't work) function get_Results(CURR,COURSE) { var strURL="/textbookresults.php?CURR="+CURR+"&COURSE="+COURSE; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { document.getElementById('RESULTS_div').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } and this is the last query used to display the results... $query = "SELECT * FROM UGASU11 WHERE CURR = '$CURR' AND COURSE = '$COURSE' order by INSTRUCTOR";
  6. so... it isn't working as I need it to. The last function get_Results is only calling the COURSE variable. I need it to call TERM, CURR, and COURSE in order to find the correct results.
  7. Ok, got it to update my <div id="mini"> with function callback_fn () { var strURL="/TKMINI.html"; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { document.getElementById('mini').innerHTML=req.responseText; } } } req.open("GET", strURL, true); req.send(null); } } </script> Next step, hide <div id="bookcart"> function callback_fn () { var strURL="/TKMINI.html"; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { document.getElementById('mini').innerHTML=req.responseText; } } } req.open("GET", strURL, true); req.send(null); } setTimeout( "jQuery('#bookcart').fadeOut();",1000 ); } Problem is that it hides the 'mini' div, not just bookcart, and I can't figure out why. html <div id="mini"> ---CONTENT--- <div class="hidden"> <div id="bookcart"> <div id="minibask">---CONTENT---</div> <div id="minibask_total">---MORE CONTENT---</div> </div> </div> </div> - OR - html/Miva script (if you're familiar with Miva Merchant) <div id="mini"> <mvt:item name="toolkit" param="basket|itemcount" /> <mvt:if expr="g.itemcount GT 0"> <a href="&mvt:global:secure_sessionurl;Screen=BASK" title="checkout" border="0"><img src="graphics/00000001/images/ShoppingCart.png" class="textmiddle" alt="Shopping Cart" /></a> <h8><strong>(&mvte:toolkit:basketcount;)</h8></strong> <div class="hidden"><mvt:item name="toolkit" param="render|TKMINI" /></div> <mvt:else> <a href="&mvt:global:secure_sessionurl;Screen=BASK" title="checkout" border="0"><img src="graphics/00000001/images/ShoppingCart.png" class="textmiddle" alt="Shopping Cart" /></a> (0) </mvt:if> </div> css #mini { padding: 2px; width:150px; float:right; } #mini .hidden { display:none; } #mini:hover .hidden { display:inline; } #minibask { background-color: #eeeeee; border:#cccccc 2px solid; position:relative; width:350px; line-height:1.1em; z-index:100; } #minibask_total { background-color: #cccccc; border:#cccccc 2px solid; width:350px; text-align:right; position:relative; z-index:100; line-height:1.1em; } Any Ideas?
  8. Thanks for responding! I should mention that I am quite a newbie to .js I have been searching the web for callback functions but I don't know that I am moving in the right direction. Could you share some sites that could help me out? I take that I need to edit the .js file and put a script in my html?
  9. Hi All! I am using a Greybox (found at: orangoo.com/labs/GreyBox/) to display my product pages, like the quick product display on Target.com. I have a minibasket in a div on the parent page where after a product is added to the cart the div updates and displays the cart info onhover. Problem is that the only way I know of to update the parent page is modifying the gb_scripts.js with 'this.reload_on_close=true' 'window.location.reload(true);' I want to avoid reloading the entire parent page so that the customer doesn't have to restart their product search - as it gets reset when the page reloads. Is there a way to only refresh the minibasket div?
  10. It is. Thank You SO MUCH for all of your help! I really can't give you even praise and thanks!
  11. RESOLVED! I don't know why I didn't think of this earlier, but I didn't need to string my variables together (TERM,CURR,COURSE) as the function somehow already stored the first two variables.
  12. the alert box is telling me that my variables (TERM,CURR,COURSE) are undefined...
  13. main.php <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>OCBS Textbooks</title> <meta name="GENERATOR" content="Arachnophilia 4.0"> <meta name="FORMATTER" content="Arachnophilia 4.0"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <link href="css/00000001/style.css" rel="stylesheet" type="text/css"> <link href="css/00000001/layout.css" rel="stylesheet" type="text/css"> <script language="javascript" type="text/javascript"> // Roshan's Ajax dropdown code with php // This notice must stay intact for legal use // Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com // If you have any problem contact me at http://roshanbh.com.np function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function get_CURR(TERM) { var strURL="findCURR.php?TERM="+TERM; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('CURR_div').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function get_COURSE(CURR) { var strURL="findCOURSE.php?CURR="+CURR; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('COURSE_div').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function get_Results(TERM,CURR,COURSE) { var strURL="textbookresults.php?TERM="+TERM+"&CURR="+CURR+"&COURSE="+COURSE; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { alert("Response "+req.responseText); document.getElementById('RESULTS_div').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/Futura_MdCn_BT_400.font.js"></script> <script type="text/javascript" src="js/cufon-replace.js"></script> <script type="text/javascript" src="js/maxheight.js"></script> <script type="text/javascript">var GB_ROOT_DIR = "http://shopocbs.com/greybox/";</script> <script type="text/javascript" src="greybox/AJS.js"></script> <script type="text/javascript" src="greybox/AJS_fx.js"></script> <script type="text/javascript" src="greybox/gb_scripts.js"></script> <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css"> <!--[if lt IE 7]> <link href="ie.css" rel="stylesheet" type="text/css" /> <![endif]--> </head> <body id="page2" onload="new ElementMaxHeight();"> <div id="main-tail-hor"> <div id="main-bg"> <div id="main-tail-ver"> <div id="main-bg-top"> <div id="main-bg-bot"> <div id="main"> <!-- header --> <div id="textbookheader"> <a href="shopocbs.com"><img src="graphics/00000001/images/logo.gif" id="logo" alt=""></a> <a href="#" id="rss">RSS Submit</a> <div id="menu"> <ul> <li><a href="http://www.shopocbs.com/ABUS.html"><span><span>Store Info</span></span></a></li> <li><a href="http://www.shopocbs.com/Apply.html"><span><span>Apply</span></span></a></li> <li><a href="http://www.shopocbs.com/TSRV.html"><span><span>Tech Services</span></span></a></li> <li><a href="http://www.shopocbs.com/GEAR.html"><span><span>UGA Gear</span></span></a></li> <li class="act"><a href="#"><span><span>TEXTBOOKS</span></span></a></li> </ul> </div> <div id="HOME" onclick="location.href='http://www.shopocbs.com';" style="cursor:pointer;"></div> <img src="graphics/00000001/images/textbookslogan.gif" id="slogan" alt=""> </div> <!-- content --> <div id="content"> <div class="row-1"> <div class="wrapper"> <div class="col-1 maxheight"> <h2><b><b>Select Your Books</b></b></h2> <div class="indent-1"> <form method=post name=textbookform action='textbookresults.php' target='iframe'> <div id="first_drop_down"> <select name="TERM" onChange="get_CURR(this.value)"> <option>Select Term</option> <option value=SU11>SU11</option> </select> </div> <div id="CURR_div"><select><option>Select Term First</option></select></div> <div id="COURSE_div"><select><option>Select Curriculum First</option></select></div><br /> <input type="button" value="Get My Books" onClick="get_Results();"> </form></div> <div class="indent-1"> <h4>Textbook Rental Program</h4> <a href="http://www.shopocbs.com/rentals.html" onclick="return GB_showCenter('Rental Agreement', this.href)" class="link">Rental Agreement</a> <div class="clear"></div> <a href="#" class="link">Registration Form</a> </div> <div class="indent-1"> <h4>Baxter Street Bookstore</h4> <a href="#" class="link">UGA Law School Books</a> </div> <div class="indent-1"> <h4>East Campus Bookstore</h4> <a href="http://www.ecbsonline.com" class="link">UGA IDL Books</a> <div class="clear"></div> <a href="http://wwww.ecbsonline.com" class="link">Athens Tech Books</a> <div class="clear"></div> <a href="http://ecbsonline.com" class="link">GSC Books</a> <div class="clear"></div> </div> </div> <div class="col-2 maxheight"> <h2><b><b>Your Textbook Information</b></b></h2> <div class="indent-1"> <iframe id="iframe" name="iframe" width="100%" height="35%"> <p>Your browser does not support iframes.</p> </iframe></div> </div> </div> </div> </div> <div class="row-2"> <h3><span><span><strong>Interesting Links</strong></span></span></h3> <div class="box"> <div class="inner-1"> <div class="wrapper"> <ul class="list-2"> <li> <a href="http://oasisweb.uga.edu"><img src="graphics/00000001/images/oasis.jpg" alt="Oasis Web" /></a> <strong><a href="http://oasisweb.uga.edu">Oasisweb.uga.edu</a></strong> Online Access to UGA Student Information Systems </li> <li> <a href="http://www.studentnotes.com/UGAstudent_notes.html"><img src="graphics/00000001/images/student_notes.jpg" alt="Student Notes" /></a> <strong><a href="http://www.studentnotes.com/UGAstudent_notes.html">Student Notes</a></strong>Study Guides complied by students with a 3.4+ G.P.A.</li> <li><a href="http://www.secsports.com"><img src="graphics/00000001/images/sec.jpg" alt="SEC Sports" /></a> <strong><a href="http://www.secsports.com">SECsports.com</a></strong> The official site of the Southeastern Conference </li> <li class="extra"> <a href="http://www.dawgwear.net"><img src="graphics/00000001/images/dawgwear.jpg" alt="Dawgwear.net" /></a> <strong><a href="http://www.dawgwear.net">Dawgwear.net</a></strong> UGA Merchandise, apparel, gifts, Diploma Frames, and more!</li> </ul> </div> </div> </div> </div> </div> <!-- footer --> <div id="footer"> <p>OCBS, Inc.<span> © 2009</span> | <a href="http://www.facebook.com/pages/Off-Campus-Bookstore/51670009168" target="blank"> <img src="facebook_footer.png" alt="Find us on Facebook" /></a></p> </div> </div> </div> </div> </div> </div> </div> <script type="text/javascript"> Cufon.now(); </script> </body> </html> I think these are the same but I will report them just to make sure... findCURR <!--//---------------------------------+ // Developed by Roshan Bhattarai | // http://roshanbh.com.np | // Contact for custom scripts | // or implementation help. | // email-nepaliboy007@yahoo.com | //---------------------------------+--> <? #### Roshan's Ajax dropdown code with php #### Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com #### if you have any problem contact me at http://roshanbh.com.np #### fell free to visit my blog http://roshanbh.com.np ?> <select name="CURR" onchange="get_COURSE(this.value)"> <option>Select Curriculum</option> <?php require "config.php"; $TERM=$_GET['TERM']; $query = "SELECT DISTINCT CURR FROM UGASU11 WHERE TERM = '$TERM' order by CURR"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { ?> <option value=<?php echo $row['CURR']?>><?php echo $row['CURR']?></option> <? } ?> </select> findCOURSE <!--//---------------------------------+ // Developed by Roshan Bhattarai | // http://roshanbh.com.np | // Contact for custom scripts | // or implementation help. | // email-nepaliboy007@yahoo.com | //---------------------------------+--> <? #### Roshan's Ajax dropdown code with php #### Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com #### if you have any problem contact me at http://roshanbh.com.np #### fell free to visit my blog http://roshanbh.com.np ?> <select name="COURSE"> <option>Select Course</option> <?php require "config.php"; $CURR=$_GET['CURR']; $query = "SELECT DISTINCT COURSE FROM UGASU11 WHERE CURR = '$CURR' order by COURSE"; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { ?> <option value=<?php echo $row['COURSE']?>><?php echo $row['COURSE']?></option> <? } ?> </select>
  14. dd3ck.php works and give me the results I want and need when not trying to post them to a div so I don't think the syntax is wrong there (but what do I rally know?). Could it be I am not calling the right variables in the function? I tried what you gave me and got the alert There was a problem while using XMLHTTP Internal Server Error
  15. Oh, wow, sorry! This is the alert Response <style type="text/css"> A:link {color: white;} A:hover {color: red;} </style> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Textbooks</title> <script type="text/javascript"> var GB_ROOT_DIR = "greybox/"; </script> <script type="text/javascript" src="greybox/AJS.js"></script> <script type="text/javascript" src="greybox/AJS_fx.js"></script> <script type="text/javascript" src="greybox/gb_scripts.js"></script> <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.6.1.min.js"></script> </head> <body> <table style='color:#fff;'></table></body></html> It's not generating the php...?
  16. nothing is printed when I submit the form... http://www.dawgwear.net/main.php function get_Results(COURSE) { var strURL="dd3ck.php?COURSE="+COURSE; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('RESULTS_div').innerHTML=req.responseText; } else { alert("Response "+req.responseText); } } } req.open("GET", strURL, true); req.send(null); } } function get_Results(COURSE) { var strURL="dd3ck.php?" var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('RESULTS_div').innerHTML=req.responseText; } else { alert("Response "+req.responseText); } } } req.open("GET", strURL, true); req.send(null); } } function get_Results(TERM,CURR,COURSE) { var strURL="dd3ck.php?TERM="+TERM+"&CURR="+CURR+"&COURSE="+COURSE; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('RESULTS_div').innerHTML=req.responseText; } else { alert("Response "+req.responseText); } } } req.open("GET", strURL, true); req.send(null); } }
  17. I really appreciate your help. I have been fooling around with it all day and cannot get it to work. I don't know if I am using the wrong variables or what exactly I am doing wrong. I basically want everything in dd3ck.php to load into the div. dd3ck.php When I input all the variables... function get_Results(TERM,CURR,COURSE) { var strURL="dd3ck.php?TERM="+TERM+"&CURR="+CURR+"&COURSE="+COURSE; the dropdowns all populate and the text in the RESULTS_div goes away, but the result doesn't display..
  18. You are a GENIUS! Not sure what I had wrong, but I just copied your code and now it works. Thank You Thank You Thank You! Now, if that wasn't enough.... I am playing around with how to submit the results I want (from dd3ck.php) into a div on that page. If you still have anything left to give me I would surely appreciate it. Again, THANKS man, you Rock!
  19. I cant even get the third text box to load. Here is the page I am working on... http://www.dawgwear.net/main.php
  20. I don't know if this helps identify my problem, but in IE I am getting a 'document.getElementById(...)' is null or not an object error message for function getCOURSE(CURR) { var strURL="findCOURSE.php?CURR="+CURR; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('COURSEdiv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } }
  21. I've got the first and the second drop down to populate, but I cannot get the third. config.php <?php //////////// Change the data part only with your database login details ///////////////// $dbservertype='mysql'; // hostname or ip of server $servername='localhost'; $dbusername=''; $dbpassword=''; $dbname=''; ////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////// ////// DONOT EDIT BELOW ///////// /////////////////////////////////////// connecttodb($servername,$dbname,$dbusername,$dbpassword); function connecttodb($servername,$dbname,$dbuser,$dbpassword) { global $link; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); } ?> main.php <html> <head> <title>Textbooks</title> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/cufon-replace.js"></script> <!--[if lt IE 7]> <![endif]--> <script language="javascript" type="text/javascript"> // Roshan's Ajax dropdown code with php // This notice must stay intact for legal use // Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com // If you have any problem contact me at http://roshanbh.com.np function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function get_CURR(TERM) { var strURL="findCURR.php?TERM="+TERM; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('CURR_div').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function get_COURSE(CURR) { var strURL="findCOURSE.php?CURR="+CURR; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('COURSE_div').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> </head> <body id="page2" onload="new ElementMaxHeight();"> <h2><b><b>make your selection</b></b></h2> <form method=post name=f1 action='dd3ck.php'> <div id="first_drop_down"> <select name="TERM" onChange="get_CURR(this.value);get_COURSE(0)"> <option>Select Term</option> <?php require "config.php"; $query=("SELECT DISTINCT TERM FROM SUMMER"); $result=mysql_query($query); while($row=mysql_fetch_array($result)) { ?> <option value=<?php echo $row['TERM']?>><?php echo $row['TERM']?></option> <? } ?> </select> </div> <div id="CURR_div"> <?php include ('findCURR.php'); ?> </div> <div id="COURSE_div"> <?php include ('findCOURSE.php'); ?> </div> </form> <div class="col-2 maxheight" style="margin-left: 0"> <h2><b><b>textbook information</b></b></h2> <iframe id="iframe" name="iframe" width="100%" height="80%"> <p>Your browser does not support iframes.</p> </iframe> </div> <script type="text/javascript"> Cufon.now(); </script> </body> </html> findCURR.php ************************************************************************* <!--//---------------------------------+ // Developed by Roshan Bhattarai | // http://roshanbh.com.np | // Contact for custom scripts | // or implementation help. | // email-nepaliboy007@yahoo.com | //---------------------------------+--> <? #### Roshan's Ajax dropdown code with php #### Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com #### if you have any problem contact me at http://roshanbh.com.np #### fell free to visit my blog http://roshanbh.com.np ?> <? $TERM=intval($_GET['TERM']); $CURR=intval($_GET['CURR']); $COURSE=intval($_GET['COURSE']); require "config.php"; if ($TERM!=0) { $query="SELECT DISTINCT CURR FROM SUMMER where TERM='$TERM' order by CURR"; $result=mysql_query($query); } else { $query="SELECT DISTINCT CURR FROM SUMMER order by CURR"; $result=mysql_query($query); } ?> <select name="CURR" onchange="get_COURSE(this.value)"> <option>Select Curriculum</option> <? while($row=mysql_fetch_array($result)) { ?> <option value=<?=$row['CURR']?>><?=$row['CURR']?></option> <? } ?> </select> ************************************************************************* findCOURSE.php ************************************************************************* <!--//---------------------------------+ // Developed by Roshan Bhattarai | // http://roshanbh.com.np | // Contact for custom scripts | // or implementation help. | // email-nepaliboy007@yahoo.com | //---------------------------------+--> <? #### Roshan's Ajax dropdown code with php #### Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com #### if you have any problem contact me at http://roshanbh.com.np #### fell free to visit my blog http://roshanbh.com.np ?> <? $CURR=intval($_GET['CURR']); $COURSE=intval($_GET['COURSE']); require "config.php"; if ($CURR!=0) { $query="SELECT DISTINCT COURSE FROM SUMMER where CURR='$CURR' order by COURSE"; $result=mysql_query($query); } else { $query="SELECT DISTINCT COURSE FROM SUMMER order by COURSE"; $result=mysql_query($query); } ?> <select name="COURSE"> <option>Select Course</option> <? while($row=mysql_fetch_array($result)) { ?> <option value=<?=$row['COURSE']?>><?=$row['COURSE']?></option> <? } ?> </select> *************************************************************************
  22. #1 I'm not sure how to export my DB in the same way that Geek did, so if this doesn't work for you let me know how I should export it. I'm using one table. I have included the first 10 listings as there are over 900 in the table. -- phpMyAdmin SQL Dump -- version 3.3.9.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 13, 2011 at 09:22 AM -- Server version: 5.0.92 -- PHP Version: 5.2.9 SET AUTOCOMMIT=0; START TRANSACTION; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `DB` -- -- -------------------------------------------------------- -- -- Table structure for table `SUMMER` -- DROP TABLE IF EXISTS `SUMMER`; CREATE TABLE IF NOT EXISTS "SUMMER" ( "id" int(11) NOT NULL, "TERM" varchar(4) default NULL, "CURR" varchar(4) default NULL, "COURSE" varchar(12) default NULL, "TITLE" varchar(60) default NULL, "AUTHOR" varchar(13) default NULL, "EDITION" varchar(4) default NULL, "INSTRUCTOR" varchar(15) default NULL, "ISBN" varchar(10) default NULL, "ALT ISBN" varchar(10) default NULL, "PUBLISHER" varchar(5) default NULL, "NEW PRICE" decimal(18,15) default NULL, "USED PRICE" decimal(17,15) default NULL, PRIMARY KEY ("id") ) AUTO_INCREMENT=902 ; -- -- Dumping data for table `SUMMER` -- INSERT INTO `SUMMER` (`id`, `TERM`, `CURR`, `COURSE`, `TITLE`, `AUTHOR`, `EDITION`, `INSTRUCTOR`, `ISBN`, `ALT ISBN`, `PUBLISHER`, `NEW PRICE`, `USED PRICE`) VALUES (1, 'SU11', 'ACCT', '2101', 'FINANCIAL ACCT UGA CUSTOM (1SS)', 'WILD', '00', 'BHANDARKAR12989', '0390306916', '0390306916', 'PRIMU', 108.150000000000000, 81.099999999999990), (2, 'SU11', 'ACCT', '2101', 'FINA & MANAGERIAL ACCT SG CH 1-15 ', 'WARREN', '10TH', 'LYMAN', '0324664648', '0324664648', 'CENGA', 38.750000000000000, 29.050000000000000), (3, 'SU11', 'ACCT', '2101', 'FINA & MANAGERIAL ACCT WKPR CH 1-15 ', 'WARREN', '10TH', 'LYMAN', '0324664664', '0324664664', 'CENGA', 40.600000000000000, 30.450000000000000), (4, 'SU11', 'ACCT', '2101', 'FINA & MANAGERIAL ACCT WKPR CH 1-15 ', 'WARREN', '10TH', 'BLAIR/WILLIAMS', '0324664664', '0324664664', 'CENGA', 40.600000000000000, 30.450000000000000), (5, 'SU11', 'ACCT', '2102', 'CORNERSTONES OF MGRL ACCT (2SS) ', 'MOWEN/HEITGER', '3RD', 'MATTHEWS 02991', '0324660138', '0324660138', 'CENGA', 219.700000000000000, 99.999999999999999), (6, 'SU11', 'ACCT', '2102', 'CORNERSTONES OF MGRL ACCT LLF VALUE ED (2SS) ', 'MOWEN/HEITGER', '3RD', 'MATTHEWS 02991', '1111527504', '1111527504', 'CENGA', 138.750000000000000, 99.999999999999999), (7, 'SU11', 'ACCT', '2102', 'FINA & MANAGERIAL ACCT SG CH 16-26 ', 'WARREN', '10TH', 'LYMAN', '0324664656', '0324664656', 'CENGA', 38.750000000000000, 29.050000000000000), (8, 'SU11', 'ACCT', '7651', 'PRIN OF FRAUD EXAMINATION (MAY)', 'WELLS', '3RD', 'CARPENTER 93002', '0470646292', '0470646292', 'WILEY', 168.750000000000000, 99.999999999999999), (9, 'SU11', 'ACCT', '2101/2102', 'FINA & MANAGERIAL ACCT ', 'WARREN', '10TH', 'ALL', '0324663811', '0324663811', 'CENGA', 200.000000000000000, 99.999999999999999), (10, 'SU11', 'ACCT', '2101/2102', 'FINA & MANA ACCT ', 'WARREN', '10TH', 'STAFF', '0324664575', '0324664575', 'CENGA', 146.700000000000000, 99.999999999999999), #2 currently the form submits the result into an iframe... echo "<form method=post name=f1 action='dd3ck.php' target='content'>"; echo "<select name='COURSE' onChange='document.f1.submit()'><option value=''>Select Course</option>"; Instead, I would like to submit the results into a div on the page.
  23. Hi. I've been trying to figure this out for sometime now. I have two issues with the code I have. #1 - I need the page to not reload when each selection is made #2 - I need the form to submit into a div instead of an iframe I have tried what is posted, but I can't get it to work. I would really appreciate any help! <?php //*************************************** // This is downloaded from www.plus2net.com // /// You can distribute this code with the link to www.plus2net.com /// // Please don't remove the link to www.plus2net.com /// // This is for your learning only not for commercial use. /////// //The author is not responsible for any type of loss or problem or damage on using this script.// /// You can use it at your own risk. ///// //***************************************** require "config.php"; // Your Database details ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Textbooks</title> <meta name="GENERATOR" content="Arachnophilia 4.0" /> <meta name="FORMATTER" content="Arachnophilia 4.0" /> <SCRIPT language=JavaScript> function reload(form) { var val=form.TERM.options[form.TERM.options.selectedIndex].value; self.location='dd3.php?TERM=' + val ; } function reload3(form) { var val=form.TERM.options[form.TERM.options.selectedIndex].value; var val2=form.CURR.options[form.CURR.options.selectedIndex].value; self.location='dd3.php?TERM=' + val + '&CURR=' + val2 ; } </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <script type="text/javascript">var GB_ROOT_DIR = "/greybox/";</script> <script type="text/javascript" src="/greybox/AJS.js"></script> <script type="text/javascript" src="/greybox/AJS_fx.js"></script> <script type="text/javascript" src="/gb_scripts.js"></script> <link href="/greybox/gb_styles.css" rel="stylesheet" type="text/css" /> </style> </head> <body id="page2" onload="new ElementMaxHeight();"> <div class="col-1 maxheight" style="width: 253px; height: 718px"> <h2><b><b>make your selection</b></b></h2> <div class="indent-1" style="width: 280px; height: 415px"> <h4 class="auto-style2">Textbook Information</h4><br /> <span class="auto-style4">Course information</span><br /><br /> <? $cat=$_POST['TERM']; $subcat=$_POST['CURR']; $subcat3=$_POST['COURSE']; ///////// Getting the data from Mysql table for first list box////////// $quer2=mysql_query("SELECT DISTINCT TERM FROM SUMMER order by TERM"); ///////////// End of query for first list box//////////// /////// for second drop down list we will check if category is selected else we will display all the subcategory///// @$cat=$_GET['TERM']; // This line is added to take care if your global variable is off if(isset($cat) and strlen($cat) > 0){ $quer=mysql_query("SELECT DISTINCT CURR FROM SUMMER where TERM = '$cat' order by CURR"); }else{$quer=mysql_query("SELECT DISTINCT CURR FROM SUMMER order by CURR"); } ////////// end of query for second subcategory drop down list box /////////////////////////// /////// for Third drop down list we will check if sub category is selected else we will display all the subcategory3///// @$cat3=$_GET['CURR']; // This line is added to take care if your global variable is off if(isset($cat3) and strlen($cat3) > 0){ $quer3=mysql_query("SELECT DISTINCT COURSE FROM SUMMER where TERM = '$cat' AND CURR = '$cat3' order by COURSE"); }else{$quer3=mysql_query("SELECT DISTINCT COURSE FROM SUMMER order by COURSE"); } ////////// end of query for third subcategory drop down list box /////////////////////////// echo "<form method=post name=f1 action='dd3ck.php' target='content'>"; ////////// Starting of first drop downlist ///////// echo "<select name='TERM' onchange=\"reload(this.form)\"><option value=''>Select Term</option>"; while($row = mysql_fetch_array($quer2)) { if($row['TERM']==$cat){echo "<option selected value='$row[TERM]'>$row[TERM]</option>"."<BR>";} else{echo "<option value='$row[TERM]'>$row[TERM]</option>";} } echo "</select>"; ////////////////// This will end the first drop down list /////////// echo "<br />"; ////////// Starting of second drop downlist ///////// echo "<select name='CURR' onchange=\"reload3(this.form)\"><option value=''>Select Curriculum</option>"; while($row = mysql_fetch_array($quer)) { if($row['CURR']==$cat3){echo "<option selected value='$row[CURR]'>$row[CURR]</option>"."<BR>";} else{echo "<option value='$row[CURR]'>$row[CURR]</option>";} } echo "</select>"; ////////////////// This will end the second drop down list /////////// echo "<br />"; ////////// Starting of third drop downlist ///////// echo "<select name='COURSE' onChange='document.f1.submit()'><option value=''>Select Course</option>"; while($row = mysql_fetch_array($quer3)) { echo "<option value='$row[COURSE]'>$row[COURSE]</option>"; } echo "</select>"; ////////////////// This will end the third drop down list /////////// echo "</form>"; ?> </div> </div> <div class="col-2 maxheight" style="margin-left: 0"><h2><b><b>textbook information</b></b></h2> <iframe id="content">*****Books will be listed here after selection is made*****</iframe> </div> <script type="text/javascript"> Cufon.now(); </script> </body> </html>
  24. This script works great, the only problem is that it reloads the page on each selection. I use flash and would really like the page (and flash content) to not be reloaded on each selection. The code is below... <?php //*************************************** // This is downloaded from www.plus2net.com // /// You can distribute this code with the link to www.plus2net.com /// // Please don't remove the link to www.plus2net.com /// // This is for your learning only not for commercial use. /////// //The author is not responsible for any type of loss or problem or damage on using this script.// /// You can use it at your own risk. ///// //***************************************** require "config.php"; // Your Database details ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <meta name="GENERATOR" content="Arachnophilia 4.0" /> <meta name="FORMATTER" content="Arachnophilia 4.0" /> <SCRIPT language=JavaScript> function reload(form) { var val=form.TERM.options[form.TERM.options.selectedIndex].value; self.location='http://www.dawgwear.net/dd3.php?TERM=' + val ; } function reload3(form) { var val=form.TERM.options[form.TERM.options.selectedIndex].value; var val2=form.CURR.options[form.CURR.options.selectedIndex].value; self.location='http://www.dawgwear.net/dd3.php?TERM=' + val + '&CURR=' + val2 ; } </script> I'm new to php/ajax so I would really appreciate some help or direction as to where I can get some answers! Thanks in advance! Jeanna
  25. --------EDIT FOR INITIAL POST-------------(not sure why I can't modify the original post) echo "<form method=post name=f1 action='dd3.php'>"; is actually echo "<form method=post name=f1 action='dd3ck.php'>"; in my current code
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.