----- Original Message ----
From: alternate_dph <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, June 2, 2006 1:06:52 AM
Subject: [php-list] Drop down list box question
Thanks for the suggestions on how to change my code to make the
workaround for subqueries.
I have another question.
$query = "SELECT story_id, story_name FROM tgs_story";
$result=mysql_query($query) or die("Unable to view data\ n");
$story_name=$row['story_name'];
$story_id=$row['story_id'];
How would I put the results into a drop down list box on a form so
that, on the form, the user sees and selects a $story_name, but when
the data is actually posted, the corresponding $story_id is sent out?
[reply]
<select name="story_id">
<?php
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){
echo "<option value='{$row['story_id']}'>{$row['story_name']}</option>";
}
?>
</select>
Hope this helps, and good luck,
-Nick
[/reply]
[Non-text portions of this message have been removed]
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
SPONSORED LINKS
| Php mysql | Job postings |
YAHOO! GROUPS LINKS
- Visit your group "php-list" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
