Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP helo on how to create a drop down box using information in a MySQL database
Old 02-21-2010, 11:31 AM PHP helo on how to create a drop down box using information in a MySQL database
Junior Talker

Posts: 1
Name: Katie Derham
Trades: 0
I’m desperate for help, I’m creating a website which allows people to sell second hand dancewear online, its just for a project i have to do at uni. Basically i have two tables – a sell table and a product category table. In order to sell an item the user completes an interactive form, in which they must select a category for that product to be sold in (a bit like ebay). I am struggling on how to get what is selected from the drop down box (the category which should be stored in the database) to be written back to the database (i.e. the value to be stored in the sell table alongside the items details). I cannot work out how to create my drop down box so it displays the categories stored in the product category table , and I cannot work out, how when one of these is selected and the form is submitted how to get the id of category to be stored alongside the items details in the sell table, please please can anybody help?!
kd2v07 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-22-2010, 04:51 PM Re: PHP helo on how to create a drop down box using information in a MySQL database
Webalized's Avatar
Experienced Talker

Posts: 33
Trades: 0
well, your drop down box should have code similar to this:
Code:
<select name="animals" id="animals">
<option value="cows">Cows</option>
<option value="ducks">Ducks</option>
</select>
then you would just do a simple query to insert that
PHP Code:
mysql_query("
INSERT INTO tbl_name 
animal VALUES ('
$_POST[animals]')
"
); 
__________________

Please login or register to view this content. Registration is FREE

Webalized is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP helo on how to create a drop down box using information in a MySQL database
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09956 seconds with 12 queries