User:RabiesTurtle/CodeHelp

'''Ok, this is a call to help for a project I am working on for Guild Wars. I am hoping that since so many on this site know a lot about coding, that someone might have a solution for me. Please let me know if you have any ideas and especially examples.'''

Background
I am trying to pull data from a mysql database and load different fields into SELECT forms. This I can do without any problems. Now, the trick is that I want the data shown in following forms to be narrowed due to the selections on the preceding forms. This is basically like going from broad options and narrowing it down to the specific choices in the last form. In the end, I want to store the selections from each form into a new table, but that will come later.

I believe I want it to show only the first form, and the second form comes after submitting which shows only options that fit with the choice from the first form. The third form shows after submitting the first two and also only shows options allowed through the first two choices.

I have the actual query working so that the values showing up in the forms is actually from the database table and the correct field. I could of course use the "Where" command in my query to narrow the form options, but I want it to be done automatically through the previous form choices.

Example Forms
Wiki doesn't allow use of html forms, so use your imagination :)

________________ Monk Necromancer ________________

________________ Wand Staff Focus Item ________________

________________ Brohn's Holy Rod Jayne's Staff Ajamahn's Artifact Wioli's Artifact Darkwish, The Bortak's Bone Staff Chan's Greed ________________

Example Code
This is some of the current code I have for the query and displaying a form. It is very sloppy right now and might have some things which don't make sense, but that is because I am experimenting with different ideas people give me.

/* Performing SQL query for Class*/ $queryClass = "	SELECT DISTINCT Class       FROM db_unique        ORDER BY Class"; $recordsetClass = mysql_query($queryClass) or die("Query1 failed");

 -- Please Select Class -- ".$Class." \n"; } ?> 

Responses (if any)
I haven't coded php in a long time so I'm fairly rusty. However, as I recall, when you submit an html form to a php page all the form values get defined as variables based on the input names. So say you have an  When you submit that form to a php page you'll get a variable called $Weapon. So using that you can build your sql query to be 'select * from TableName where Type = ".$Weapon.' and so forth. Lojiin 16:10, 24 January 2007 (CST)
 * Yea, that is the main thing I am trying. I think I have to use $_REQUEST['formVariable'] since I don't have Register Globals turned on with my php.  Right now when I try that though, it displays nothing since nothing is selected yet by default.  I need to put an if statement with isset stuff going on... but just have to figure it out. --RabiesTurtle 16:23, 24 January 2007 (CST)
 * I believe you should use $_POST['formVariable'] or in this case $_POST['classFilter']. Also to check for a valid value you can use an ifcheck.  For example if(!$_POST['classFilter']){echo "Please select a class"; return}.   You might also want to have a glance at http://apptools.com/phptools/forms/ Lojiin 16:34, 24 January 2007 (CST)