I'm constructing a form where a user can choose something from a dropdown box, then a different form is loaded depending on their selection.
For example if they chose "car" it would load a form for buying a car. However if they chose "dog" it would ask type of dog, etc etc.
I'm having trouble understanding the format in which data is passed to a page. For example, if I have a script in a file called "formLoader.php" that uses a variable name "$selection" to query the database and return the parsed form, how does passing code like the snippet below tell the file to set the value of "$selection" to 'car' for example?
$("button").click(function(){
$.post("formLoader.php",
{
selector:"car"
}
});
});
In other words, when you pass data, how do you assign that data to a variable in a php file?
Thanks