I’m using $intVariable=(int)$_GET[var1];
to output and select a variable in mysql records i.e /myfile.php?cat=5 selects different results.
I am dealing with a dropdown from SQL so need to output a list based on selected ID’s.. so I need to have something like /myfile.php?var1=X&var2=Y
I’m actually using a bit of JavaScript too, so unsure whether it’s PHP or JS I need to adjust to grab another variable.
This code + some PHP currently outputs the selected ID of my selection in the title bar..
function reload(form)
{
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='myfile.php?var1=' + val ;
}
How do I achieve this multi tier structure getting 2 variables from the title, so I can use multiple variable to assign in my MYSQL selects. have tier dropdown lists
Not really sure what exact answer your looking for, but to fix your function to add more vars:
In general:
what your setting there is the GET parameters in the URL, so for example to set the variables “name” and “age” you would do:
Where name is bob and age is 17
The other way people do it is through html arrays, so:
On the php side, $_GET[‘people’] will return an array with the two strings bob and fred.
If your using javascript to construct the url, you need to js to create a url like the one above, I’m guessing it should return
When your reloading the form, to retain the selected drop down, you need to do one of two things
JS: Recommended
or in the php