PowWeb Forums - The Perfect Community for the Perfect Host  

Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more.

Go Back   PowWeb Community Forums > The PowWeb Platform > MySQL
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
 
Thread Tools Search this Thread
Old 1-15-05, 07:47 PM   #1
Trainacomin
 
Join Date: Mar 2004
Location: Aubrey,TX
Posts: 35
Reputation: 5
populating Form Options from table

I'm trying see if it's possible to populate an option on a form from one of my tables in my database. In my searching it appears it can be done but I can't find out how.
TIA
Clint
Trainacomin is offline  
Old 1-15-05, 11:09 PM   #2
devinemke
broken tv
 
devinemke's Avatar
 
Join Date: Dec 2001
Location: NYC
Posts: 268
Reputation: 13
a very simple example:
PHP Code:
<form action="" method="POST">
<select name="options">

<?php
// assume already connected to db
$result mysql_query('SELECT option FROM table');
while (
$row mysql_fetch_assoc($result))
{
    echo 
'<option>' $row['option'];
}
?>

</select>
<br>
<input type="submit" name="submit" value="submit">
</form>
devinemke is offline  
Closed Thread


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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 08:50 AM.


Contents ©PowWeb, Inc. ~ vBulletin, Copyright © 2000-2007 Jelsoft Enterprises Limited.