Very basic seeming PHP question here… I have a page to which I’m already passing a value, e.g.: Product.php?type=apples
Now I want a drop down form to pass another value, so i’d end up with something like: Product.php?type=apples&cost=cheap
I’ve tried putting these in a form that looks like:
<form action="./Product.php" method="POST">
<small>View:</small>
<select name="cost" onchange="this.form.submit();">
<option>Choose Metrics</option>
<option value="cheap&type=<?php echo $typeID?>"></option>
to keep the type variable and add the “cost” variable, but the ampersand gets decoded in the URL string.
Am I going about this the wrong way?
Thanks very much.
First of all, you need to change the method from
POSTtoGET.Secondly, a second variable, needs a second input field. You could use a hidden field for that, or let the user choose it. (Or do javascript manipulation)
Hidden field
This can be achieved with JavaScript too ofcourse!