What I want to do is post the $plane_name, $plane_id, and $seating_amount from the option the user selected.
If this wan't a loop I would just use a hidden input field for that, but I'm not sure how to do that in the a loop.
Short answer: don't.
Assuming that the id is the primary key of the wp_flr_planes, there is never any reason to carry the plane_name into a different table. You can simply join the records and look up the plane_name from the wp_flr_planes table. All you need to store is the primary key of the wp_flr_planes in order to look up any corresponding information.
If this is a composite key, then you do require both to be provided as the option value. The only way to do this in a select control is by using a method that allows you to pass both of the keys. An array of the two serialized would allow you to pass it as the option value, and you can unserialize it on the receiving side.
SELECT wfp.plane_name, ynt.destination
FROM yournewtable ynt
INNER JOIN wp_flr_planes wfp ON wfp.id = ynt.planeid
WHERE wfp.plane_name = 'This is the plane name'
I can't really suggest a good query since I don't know what all of your properties are, and I'm not sure how you intend to use it after. I see something like a booking, so a plane has a known name and number of seats, and is used in a booking to see a destination and date/time of departure/arrival, etc.
If you use INNODB database engine, then you can add constraints as well (that are enforced). So in the secondary table, you can specify that it's "planeid" must reference the id in the wp_flr_planes. If it doesn't exist, it will throw an error, and you can set up cascading for updates and deletes.
On the other hand, if you really *MUST* pass all 3 values--or if, for example,you don't want to even use the DB on the next page--then you can do this:
On the other hand, if you really *MUST* pass all 3 values--or if, for example,you don't want to even use the DB on the next page--then you can do this:
That puts all three values into the <option> value and, on the next page, if you do
Code:
$item = $_POST["item"];
then you can split (explode, I think, in PHP terms?) on the ## to get the 3 separate values.
I almost got this method almost working for me. The problem I having is the the last option values for $item is being posted to the database instead of the option I select.