Solved

Scroll down menu getting from database?

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
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 …

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now