futrose Posted April 11, 2011 Share Posted April 11, 2011 Can someone tell me why this gives me undefined variables? The $id variable is showing up fine in this bit of code. When I click the link it is supposed to pull the data from the database related to the $id. <a href='javascript: window.document.Vids<?php echo $id; ?>.submit();'>Watch</a> <form name="Vids<?php echo $id; ?>" action="<?php echo $PHP_SELF; ?>" method="post"> <input value="<?php echo $id; ?>" type="hidden" name="Vids" /> </form> here is the code which is supposed to display the info. if (isset($_POST['Vids'])) { $result = mysqli_query($link, "SELECT * FROM vidaud where id =".$_POST['Vids']); echo $id; the error i get is Notice: Undefined variable: id in /services5/webpages/util/b/b/bbctech2.site.aplus.net/public/dbsite/a_newsite/sermons.php on line 32 I'm just not sure why the $id variable isn't being posted by my form and read by the code. Thanks. Link to comment https://forums.phpfreaks.com/topic/233317-posting-variable-from-hyperlink/ Share on other sites More sharing options...
futrose Posted April 11, 2011 Author Share Posted April 11, 2011 nevermind, I got it. Link to comment https://forums.phpfreaks.com/topic/233317-posting-variable-from-hyperlink/#findComment-1199876 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.