Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- while($myrow = pg_fetch_assoc($result)) {
- $nameofmenu = $myrow[name];
- echo $nameofmenu; //It prints correctly the name of the menu
- echo '<form name"formname" method="post" action="resultsmenu.php">';
- echo "<input type='hidden' name='menuname' value=' $nameofmenu ' />";
- echo "<input type='submit' name='submit' value='See Menu' />";
- }
- ?>
- <?php
- $nameofmenu = $_POST['menuname'];
- $db = pg_connect('host=localhost dbname=test user=myuser password=mypass');
- $query = "SELECT * FROM menu where name='$nameofmenu'";
- $result = pg_query($query);
- if (!$result) {
- echo "Problem with query " . $query . "<br/>";
- echo pg_last_error();
- exit();
- }
- $myrow = pg_fetch_assoc($result);
- $description = $myrow[description];
- ?>
- $nameofmenu2 = "Menu3";
- $nameofmenu = $_POST['menuname']; //where the value in menuname is Menu3
- if ($nameofmenu2 = $nameofmenu){echo "Both variables are the same";}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement