Solved

Scroll down menu getting from database?

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 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