Reputation: 1
and thanks in advance for looking, your time and your help.
I am currently trying to create a drop down menu list.
it involves shiping types for example , Royal mail, DHL ect.
however i am getting no where.
i have my data base set like below
field | type | collation | null | extra
post_id | bigint(20) | | no | auto_increment
type | varchar(255) | latin_1swedish_ci | no |
the name of this in my database is called postage_type.
i have populated that tag. inside it,
royal mail (1)
DHL (2)
ect.
would it be possible for someone to share how to create a drop down form and then how to receive the data.
+
i believe i will need a $_GET
due to my pages using as such shipping_detail.php?=item2290
etc,
the page i would like the drop down box on is called "shipping_detail.php" and i would like the chosen menu option to be placed on a page called "detail.php"
thanks for looking and i hope i made this clear enough.
i have read more than a few tutorials however i am completely confused by them.
Upvotes: 0
Views: 137
Reputation: 7211
This is just a piece of cake. You only have to do is to use the include
function of PHP. Just like below.
SOLUTION CODE
<select name="your-drop-down-list-name">
<?php include('path-to-you-file-dir/shipping_detail.php'); ?>
</select>
Upvotes: 0
Reputation: 2229
I won't give you a complete answer, since your question isn't narrow and specific enough for that. But here are the things you need to do:
Here's some short example code:
The page where your dropdown is needs to have code similar to this:
<form method="GET" action="handleform.php">
<label for="shipping_method">Shipping method</label>
<select name="shipping_method" id="shipping_method">
<option value="dhl">DHL</option>
<option value="royalmail">Royal Mail</option>
</select>
<input type="submit"/>
</form>
And then in handleform.php:
$shipping_method = $_GET['shipping_method'];
// and then do whatever you need to do with this value, probably store it in a database
Honestly though, your question is a little too open ended to give a straight up answer to, since there are so many implementation specific details left out.
Upvotes: 1