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
Solved

Scroll down menu getting from database?

Posted on 2003-10-29
1
219 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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

856 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