php - Pass a variable from Page1 to Page2 -


// page 1 - code below works fine, when click href link // variable want not sent page 2.

<?php while ($row = mysql_fetch_array($result, mysql_assoc)) {     echo '<tr>             <td><a href="recipe_show.php?recipe_name=recipe_name"> ' . $row['recipe_name'] . ' </a></td>             </tr>';     $recipe_name = $row['recipe_name'];      } $_session['recipe_name'] = $recipe_name;     echo '</table>'; // close table ?>  // page2 - code below receives variable page 1,    //last 1 in table , not 1 clicked.  include ('core/init.php'); // connect database $recipe_name = $_session['recipe_name'];     echo "my recipes is: ".$recipe_name."<br>";  ?> 

try using request.since users can see/alter data, not safest way of doing job. sessions not involved in technique.

<?php    while ($row = mysql_fetch_array($result, mysql_assoc)) {        echo '<tr><td>              <a href="recipe_show.php?recipe_name='.$row['recipe_name'].'"> ' . $row['recipe_name'] . ' </a></td></tr>';      }     echo '</table>'; ?> 

// page2

 <?php     $recipe_name = $_get['recipe_name'];     echo "my recipes is: ".$recipe_name."<br>";  ?> 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -