php - echo $_GET['id'] not displaying anything -
i have page in user chooses recipe has unique id, sent page information recipe displayed not displaying anything.
$recipes = mysql_query(" select distinct `name`, `step1`, `step2`, `step3`, `image`, `reference` `recipe` r inner join `recipe_ingredients` ri on r.id = ri.recipe_id ri.ingredient_id in (".$ingredient1.",".$ingredient2.",".$ingredient3.") "); this query on main page, allows user choose set of ingredients , retrieve recipes them.
echo '<form action="recipe.php?id=<?php echo $recipe_id;?>" method="post">'; echo '<input id="search" name="look" type="submit" value="look" >'; echo '</form>'; under each recipe there button user presses, send user specific recipe.
$sql = mysql_query("select `name`, `image` `recipe` `id` = ".$_get['id']." limit 1"); this query i'm running on results page (recipe.php)
further down page ran this.
<?php echo $_get['id']; ?> it didn't display id , in url displayed this:
"recipe.php?id="
there data in table doing wrong?
the following echo syntax incorrect:
echo '<form action="recipe.php?id=<?php echo $recipe_id;?>" method="post">'; should be:
echo '<form action="recipe.php?id='.$recipe_id.'" method="post">'; i don't see setting $recipe_id, appears root of problem.
it unclear trying retrieve elusive $recipe_id from.
if trying pull in $recipes should include in sql statement:
select `id`,.... then pull in after $recipes->fetch_assoc():
$recipe_id = $recipes['id'];
Comments
Post a Comment