Forum Moderators: coopster
Quick question: I am trying to create an array that will enable me to pass two variables from a drop down menu. Here is my current setup:
First page:
<form name="form1" method="post" action="XXX.php">
<select name="ABC" id="ABC">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
<input type="submit" name="Submit" value="Go">
</form>
Second page: (XXX.php)
This is the good part that works:
<a href="http://www.example.net/click-123-456?SID=<?php print $_POST['ABC'];?>" target="_blank">DEF </a>
My problem is that I need to replicate the above link in a different part of my page. However, this additional link must have a different value. For example, if a user selects "a", then I need to create two links on the XXX.php page, one with value "a" and one with value "1". And so on for the other options.
I just do not know how to create the second variable in my form, as I assume I would be able to use POST or GET once I have that value created.
Thanks!
I doubt you need 2 links for what you're trying to accomplish.
That said you get the second value using your script, not the form.
Define an array something like this:
$arr = array('a'=>1,'b'=>2);
<a href="http://www.example.net/click-123-456?SID=<?= $arr[$_POST['ABC']];?>" target="_blank">DEF </a>