2tonejoe Posted December 7, 2007 Share Posted December 7, 2007 I am currently using the Chained Menu from dynamic drive http://dynamicdrive.com/dynamicindex1/chainedmenu/index.htm and I am running a python script via cron to generate the required config.js file. It works, except when I go to pass the selected item to the form processor on the next page using php. I get nothing. Rather than trying troubleshoot the defunct javascript I was wondering if I could generate the same type of thing with php and pass the "value="'s off to another script. Essentially I have a mysql table with records like: Name(str) Group(str) SubGroup1(str) SubGroup2(str) Members(int) The SubGroup's go up to 10, but i think you guys get the idea. I would like to have four html <selects> populated with the above data from the database. How can I do this?? Also, the Members field is a number 0-4 and I would like to populate that last <select> with x amount of options 1-x... Quote Link to comment Share on other sites More sharing options...
revraz Posted December 7, 2007 Share Posted December 7, 2007 This is what I do, I'm sure you can modify for your needs $query3 = "SELECT * FROM users_referral WHERE `active` = 1"; $result3 = mysql_query($query3) or die ("Error in query: $query3. " . mysql_error()); if (mysql_num_rows ($result3) > 0){ while ($row3 = mysql_fetch_object ($result3)) { ?> <option value=<?php echo $row3->id; ?>><?php echo $row3->name; ?></option> <?php $referralarray[$row3->id]=$row3->name; } } else { ?> <option value="None">None</option> <?php $came_from = "Not Available"; } ?> </select> Quote Link to comment Share on other sites More sharing options...
2tonejoe Posted December 7, 2007 Author Share Posted December 7, 2007 sorry, but I can't follow that. I am little green Quote Link to comment Share on other sites More sharing options...
revraz Posted December 7, 2007 Share Posted December 7, 2007 My users_referral table holds something like: id name active 1 Google 1 2 Yahoo 1 So what I do is query this table, load them up in an Object so my $row array points to each column. I then populate the options for every entry in my table. If there are no choices, I return the Not Available so at least it wont error out or be blank if the DB is down. Quote Link to comment 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.