I am trying to get the value of a drop down selection box this is he code i have tried to do it with as it is similar to how i added data to the database using $_POST I am unsure why it isn’t loading into the variable I have tried echoing the var_dump and it just returns null.
<select name="raceTrack" onchange="<?$track = $_POST['raceTrack']?>">
I am unsure of why this is happening and how to fix it I have searched Google and can’t seem to find anything.
You are mixing PHP and JavaScript. PHP executes at the server and doesn’t care what the user does at their end. Javascript executes on the users machine and doesn’t care what the server is doing.
You need to combine the two, with something like sending an
OnChangeback to the server to be able to use the variables in your PHP code – or simply have JavaScript do what it is you need doing.