?
Solved

Scroll down menu getting from database?

Posted on 2003-10-29
1
Medium Priority
?
223 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 2000 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

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…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 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