English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm using PHP 5.1 and MySql.

I have a recipe database that users can search through, based on recipeName and recipeIngredients. When they search, the results are displayed as an array of the recipeNames.

I'd like to make each element in the array a link to a single page, display_recipe, that will display the rest of the recipe information (ingredients, preparation, etc).

I suspect I'll need to use the _GET or _POST method somehow, but I'm not sure if that's the best way to do it, or how to implement it if it is.

Any help (and specific code examples!) would be greatly appreciated.

2006-11-08 07:38:32 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

GEt and Post are used in forms or queries.

you'd set up a variable page that will pull information from a database to display, based on the id of the item clicked on.

ie recipe.php?recipe=64576

Whatever code is on recipe.php will then look through the database to find recipe #64576 and then display it.

The page that links to recipe.php will have to pass that recipe variable...

something like
Click to see this recipe

2006-11-08 08:55:30 · answer #1 · answered by arus.geo 7 · 0 0

You concern is beautiful useful: You're adding the header row of your table within the loop. Echo the table tag and the header row on their possess (external the at the same time loop) . Then begin the at the same time loop to learn the rows. Instead of striking the significance of the question array right into a variable, simply echo it immediately, like this: at the same time ($row= mysql_fetch_array($outcomes)) { echo "trtd" . $row["indexx"] . "tdtd . $row["semester"] . "tdtd" . $row["day"] . "tdtd" . $row["time"] . "tdtd" . $row["teacher"] . "tdtd" . $row["situation"] . "tdtdtr"; } echo "table"; Also, why do you've got the incremented counter within the loop? The at the same time loop does not want it. It does that on it is possess, till there are not more rows. Use a CSS stylesheet for the table borders and cargo it within the HTML header. That's plenty purifier than including inline or characteristic patterns to the HTML tags.

2016-09-01 09:20:02 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers