Solved

Scroll down menu getting from database?

Posted on 2003-10-29
1
220 Views
Last Modified: 2013-12-12
I would like to have scroll down box , however instead we provided the listt(hard coded) , I would like to get the list
from the database ?
so say
we have database called
table event (
nameof event ,
event id );

so list is from the name of event ?
can someone give me illustration ?
0
Comment
Question by:wilslm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
LornaJane earned 500 total points
ID: 9642284
Here's some code to get the information you describe into a drop-down select box, I've assumed you're using mysql but if not you should be able to adapt it quite easily

<?php

echo("<select name=\"event_list\"><option>\n");

// do your mysql connecting stuff
$resultset = mysql_query("select * from event") or die(mysql_error());
while($event = mysql_fetch_array($resultset))
{
  echo("<option value=\"".$event['event_id']."\">".$event['nameofevent']."\n");
}
echo("</select>\n");

?>

Does that give you what you need?  Post back if I can help further!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP website on Linux - server DNS address could not be found. 18 87
Unwanted output from my query 5 42
Google Dork query 7 69
MySqli Real Escape String and SQL Injection 1 49
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question