Jump to content

Recommended Posts

Well cause it's missing out the whole of the while bit I guess the query is not returning anything.

But I'm also not sure the while loop is using the right syntax.

Could you try changing the page to this and see what happens?

 

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

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>

  • 2 weeks later...

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";

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.