/    Sign up×
Community /Pin to ProfileBookmark

Creating a dynamically populated restaurant menu

Hello,

I am trying to build a process that will enable my client (who owns a restaurant) to log-on to a webpage and change the daily specials by selecting food items from drop-down list menus. The newly chosen daily specials menu items will then populate on the “Daily Specials” page on his site (each menu item has a title and description.)

[B]Here’s what I’m trying to create:[/B]

The drop-down list menus to choose the daily specials will be auto-populated through a database.

Upon clicking the “update specials” button on the bottom of that page, the “Daily Specials” page on his site will display the new information.


_______________________

So far, I’ve had three or four false starts… Would anybody be able to point me in the right direction?

Thank you!

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@cbVisionApr 29.2010 — I'd recommend using a MySQL database and retrieving the info with PHP.

You're database could be very simple with one table called "items". This table would be structured like so:

ID | Item Name | Description | Daily Special

1 | Item 1 | Description of item 1 | 0

2 | Item 2 | Description of item 2 | 1

3 | Item 3 | Description of item 3 | 0

The daily special column would update with a 1 if it's the daily special.

On the web page, you'd build a PHP script to run a query on the database to pull the information where the daily special =1.

You're PHP homepage would look something like this:
[CODE]<?php
mysql_connect('yourdomain.com', 'user', 'password') or die(mysql_error());
mysql_select_db("databasename") or die(mysql_error());
$query = "select * from 'items' where daily_special = 1";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$itemName = $row['item_name'];
$itemDescription = $row['description'];
?>

<html>
<body>
<h1>This is the featured item:</h1>
<h2><?php echo $itemName; ?></h2>
<p><?php echo $itemDescription; ?></p>
</body>
</html>
[/CODE]
Copy linkTweet thisAlerts:
@ahg100authorApr 30.2010 — Thanks, cbVision!

I've formatted the database table as you suggested.

I'm having a problem creating the update record form that asks whether or not an item is a daily special.

Thanks!
×

Success!

Help @ahg100 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...