Yes, I have searched the site and Googled til the cows came home. Every answer I find either recommends I use JavaScript or wants me to sign up to see an answer (which may or may not actually help) All the answers I seeinvolve Java, which I really don't want to use unless it's necessary(I prefer to be a noob at one thing at a time!)

I would welcome a page refresh after each select from the first dropdown menu. That doesn't bother me at all. Does anyone know of a PHP-only tutorial or example script which uses a refresh after each dropdown select?

The closest solution I can find is at http://www.ashleyit.com/rs/jsrs/select/php/select.php
and I may just use and alter that to get mine to work, unless there is a php only solution.

Thanks! (again)

    That site is using javascript as well.

    I actually think you are just fine using javascript. I would use the new'ish Ajax method...then you wouldn't have an actual browser refresh.

    But that would still be the same as an all php solution.

    A true php solution would require that with each time they make a selection they would need to hit a button.

    So...it's pretty simply...this is crudely stated

    if(isset($_POST['first_button'])
    {
       // set some variables and send things back to the page...keep track of the first variable sent though...
    
       $first = $_POST['first'];
       $show_second_select = 1;
    
    }
    
    // button
    if($show_second_select = 1)
    {
       //info for showing the next select
    }
    

    Anyways, it does get a little complicated keep track of everything, but it's not really so hard. I'm just tossing a rough exampe to you.

    Good luck...v

      here is a script that a guy i work with wrote ... it pulls from a db and has a submit button for each drop down , but there is no js and it is all done on two pages ...

      //action.php

      session_start();
      require_once('dbfunc.php');
      
      print "<p>Session variables are: <br> {$_SESSION['SCHOOL']} <br> {$_SESSION['GRADE']} <br> {$_SESSION['TEACHER_ID']} <br> $quarter </p>";
      
      //TeacherCheck();
      
      switch($_GET['action']){
      	case "getstudentinfo":
      		list($_SESSION['studentid'], $_SESSION['sfirstname'], $_SESSION['slastname']) = split(',', $_GET['student']);
      		PrintK2AAsessmentForm();
      		break;
      	case "getteacherinfo":
      		list($_SESSION['teacherid'], $_SESSION['tfirstname'], $_SESSION['tlastname']) = split(',', $_GET['teacher']);
      		PrintGetStudInfoForm();
      		break;
      	case "getschoolinfo":
      		list($_SESSION['schoolid'], $_SESSION['schoolname']) = split(',', $_GET['school']);
      		PrintGetTeacherInfoForm();
      		break;
      	default:
      		PrintGetSchoolInfoForm();
      		break;
      }
      
      function GetListContents($type){
      
      $conn = ociLogon("YOUR INFO", "YOUR INFO", "YOUR INFO");
      
      switch($type){
      	case "Schools":
      		GetSchoolList($conn);
      		break;
      	case "Teachers":
      		GetTeacherList($conn);
      		break;
      	case "Students":
      		GetStudentList($conn);
      		break;
      	default:
      		exit("<option value=''>Error calling function</option></select>");
      		break;
      }
      }
      

      //dbfunc.php

      function PrintGetStudInfoForm(){
      	print "<p>Students in {$_SESSION['tlastname']} {$_SESSION['tfirstname']}'s class at {$_SESSION['schoolname']}</p>";
      	print "<form name='testform' method='get' action='action.php'>";
      	print "<!-- form to pick student info -->";
      	print "<input type='hidden' name='action' value='getstudentinfo'>";
      	print "<select name='student'>";
      	GetListContents('Students');
      	//print "<option value='6789,Jon Doe'>Doe, Jon</option>";
      	print "</select>";
      	print "<input type='submit'>";
      	print "</form>";
      }
      function PrintGetTeacherInfoForm(){
      	print "<p>Teachers at <i> {$_SESSION['schoolname']} ({$_SESSION['schoolid']})</i></p>";
      	print "<form name='testform' method='get' action='action.php'>";
      	print "<!-- form to pick teacher info -->";
      	print "<input type='hidden' name='action' value='getteacherinfo'>";
      	print "<select name='teacher'>";
      	GetListContents('Teachers');
      	//print "<option value='1234,Jane Doe'>Doe, Jane</option>";
      	print "</select>";
      	print "<input type='submit'>";
      	print "</form>";
      }
      function PrintGetSchoolInfoForm(){
      	print "<form name='testform' method='get' action='action.php'>";
      	print "<!-- form to pick school info -->";
      	print "<input type='hidden' name='action' value='getschoolinfo'>";
      	print "<select name='school'>";
      	GetListContents('Schools');
      	//print "<option value='002,Maury'>Maury HS (002)</option>";
      	print "</select>";
      	print "<input type='submit'>";
      	print "</form>";
      }	
      function PrintK2AAsessmentForm(){
      	print "It worked, here's the info:<br>";
      	print "School name: {$_SESSION['schoolname']}<br>";
      	print "School # : {$_SESSION['schoolid']}<br>";
      	print "Teacher Name: {$_SESSION['tlastname']} {$_SESSION['tfirstname']}<br>";
      	print "Teacher ID: {$_SESSION['teacherid']}<br>";
      	print "Student Name: {$_SESSION['slastname']} {$_SESSION['sfirstname']}<br>";
      	print "Student ID: {$_SESSION['studentid']}<br>";
      	print "<hr>";
      }
      
      function GetSchoolList($conn){
      
      $query = "SELECT * FROM schools ORDER BY Name";
      $statement = OCIParse($conn, $query);
      if(OCIExecute($statement)){
      	// worked
      	$template = "<option value='%s,%s'>%s (%s)</option>\n";
      	while(OCIFetchInto($statement, $row, OCI_ASSOC)){
      	//	print "<option value='002,Maury'>Maury HS (002)</option>";
      		printf($template, $row['SCHOOL'], $row['NAME'], $row['NAME'], $row['SCHOOL']);
      	}	
      }
      }	
      
      function GetTeacherList($conn){
      
      $query = "SELECT A.LAST_NAME,A.FIRST_NAME,A.TEACHER_ID,B.NAME,B.SCHOOL
            	FROM teachers A, Schools B 
      	  	WHERE B.SCHOOL = A.SCHOOL 
      	  	AND A.SCHOOL = '{$_SESSION['schoolid']}'";
      $statement = OCIParse($conn, $query);
      if(OCIExecute($statement)){
      	// worked
      	$template = "<option value='%s,%s,%s'>(%s) %s , %s</option>\n";
      	while(OCIFetchInto($statement, $row, OCI_ASSOC)){
      	//	print "<option value='002,Maury'>Maury HS (002)</option>";
      	//	printf($template, $row['SCHOOL'], $row['NAME'], $row['NAME'], $row['SCHOOL']);
      		printf($template, $row['TEACHER_ID'], $row['LAST_NAME'], $row['FIRST_NAME'], $row['TEACHER_ID'], $row['LAST_NAME'], $row['FIRST_NAME']);
      	}	
      }
      }	
      
      function GetStudentList($conn){
      
      $query = "SELECT A.STUDENT_ID, A.LAST_NAME, A.FIRST_NAME, B.SCHOOL, B.TEACHER_ID, B.HOMEROOM, C.SCHOOL, C.STUDENT_ID, C.HOMEROOM 
            FROM students A, teachers B, stu_enr C
      	  WHERE A.STUDENT_ID = C.STUDENT_ID 
      	  AND C.SCHOOL = B.SCHOOL
      	  AND B.SCHOOL = '{$_SESSION['schoolid']}'
      	  AND C.HOMEROOM = B.HOMEROOM
      	  AND B.TEACHER_ID = '{$_SESSION['teacherid']}'
      	  ORDER BY LAST_NAME";
      
      $statement = OCIParse($conn, $query);
      if(OCIExecute($statement)){
      	// worked
      	$template = "<option value='%s,%s,%s'>(%s) %s , %s</option>\n";
      	while(OCIFetchInto($statement, $row, OCI_ASSOC)){
      	//	print "<option value='002,Maury'>Maury HS (002)</option>";
      	//	printf($template, $row['TEACHER_ID'], $row['LAST_NAME'], $row['FIRST_NAME']);
      	printf($template, $row['STUDENT_ID'], $row['LAST_NAME'], $row['FIRST_NAME'], $row['STUDENT_ID'], $row['LAST_NAME'], $row['FIRST_NAME']);
      	}	
      }
      }
      
      

      hope this helps ...

        It does, rathersurf, thank you kindly 🙂

          Write a Reply...