I need some help please. I need to create a drop down list and then when the option is submitted a php script must run. The complication is I can’t hard code any of the values. I need it to be ‘dynamically created’
config.php
$number_Of_Option="3"
$Option_One_Name="Cars"
$Option_One_Year="2000"
$Option_One_Colour="Blue"
$Option_Two_Name="Houses"
$Option_Two_Year="2003"
$Option_Two_Colour="Pink"
$Option_Three_Name="Bikes"
$Option_Three_Year="1990"
$Option_Three_Colour="Orange"
Now I need the drop down to be made with the name in the drop down to be “Cars”, “Houses”, “Bikes” but they must be variable based so if I change “Cars” it will change.
Then when the option is submitted (Option Two in this case) I need $Option_Two_Year and $Option_Two_Colour to be passed to a script where these two variables are the variables in the script. So the script is always the same however if drop down one is selected then it uses variables 1 if 2 then it uses variables 2 etc. I also need to it work for an infinite number of options so at any time I can got into the config.php and add another option with its own variables. It can use arrays and jquery if that’s easier or necessary.
Thanks
Make an external file, eg. options.php, with this code:
Include this file in both the form page, and the parse script, using
include("options.php");In the form page, do:
In the parse script, do:
Now
$yearand$colourwill contain the year and colour for the option with the chosen name.