On Sun, 17 Oct 2004 17:23:14 -0700, bruce <[EMAIL PROTECTED]> wrote: > i have a prob/issue that i can't see.. i'm trying to geneate a page with > multiple lists so that the user has to select an item from all 3 lists in > order to access the next page... > > the 1st select/list allows the user to select either one or more items. the > 2nd/3rd select lists require the user to select only a single item from the > lists. > > ie: > list1 list2 list3 >submitBTN< > > the user would select the items from all three lists, and hit the selectBTN, > to go to the next page... > > the prob that i'm having is that if i simply select item(s) from the 1st > list, then the code allows the user to continue...in other words, the app > looks as though the user has selected an item from the 2nd/3rd even though > they haven't been selected... in examining the code, it appears that the > last item in the 2nd/3rd lists is being somehow read/inserted into the > items, and are somehow included in the querystring... > > my code is: > > /* > generate the state list > */ > echo" > <div style='position:absolute; top:320px; left:50px; width:400px;'> > <form name='test' method='get' action='$foo.php'>
Why $foo here? Maybe not enough context for me to understand the reason, I dunno. > <div style='position:relative; top:10px; left:10px;'> > <select multiple size=10 name='state[]'> > "; > > $state_query = "select * from stateTBL"; > $res = mysqli_query($link, $state_query); > //$res = mysql_query($query); > > //go ahead and process/populate the drop down > //menu > echo "<option value ='*'>All States</option>\n"; > while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) > { > echo "<option value > ='".$row['val']."'>".$row['name']."</option>\n"; > > } > > echo" > </select> > </div> > "; > > /* > generate the year list > */ > echo" > <div style='position:absolute; top:10px; left:240px; width:100px;'> > <select multiple size=1 name= 'year'> > "; Did you mean year[] here? Otherwise why multiple? > $year_query = "select * from yearTBL"; > $res = mysqli_query($link, $year_query); > //$res = mysql_query($query); > > //go ahead and process/populate the drop down > //menu > while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) > { > echo "<option value > ='".$row['year']."'>".$row['year']."</option>\n"; > } > > echo" > </select> > </div> > "; > > /* > generate the terms list > */ > echo" > <div style='position:absolute; top:10px; left:325px; width:100px;'> > <select name= 'term'> > "; > > $term_query = "select * from termTBL"; > $res = mysqli_query($link, $term_query); > //$res = mysql_query($query); > > //go ahead and process/populate the drop down > //menu > while($row = mysqli_fetch_array($res, MYSQL_ASSOC)) > { > echo "<option value ='".$row['ID']."'>".$row['term']."</option>\n"; > } > > echo" > </select> > </div> > "; > > $blah = $userdata['session_id']; > > echo" > <div style='position:relative; top:-150px; left:475px;'> > <input type='submit' name='sub1' value='submit'> > </div> > <input type ='hidden' name='sid' value='$blah'> > <input type='hidden' name='display' value='state'> > </form> > </div> > "; > > in foo.php, i simply display the $_GET['state'], $_GET['year'],$_GET['term'] > vars to see what they are... > > if i make all the select vars for the query terms arrays, it works as it > should, in that if all three lists aren't selected, then the user can't > proceed. however, if i use the select <select name = 'foo'> for the 2nd/3rd > lists, then the logic screws up... > > any idea why this is occuring.... > > is there a better way/example of using multiple drop down lists within a > single form..... Possibly. I'd recommend using print_r($_GET) to see your form submissions. To make sure your actually getting what you want to be getting. > any thoughts/comments/pointers would be helpful.. i'm pretty sure that the > issue/prob is rather straight forward/simple, but i can't see it right > now.... Not sure exactly what is broken, is that your entire script as posted? -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php