Jump to content

posting variable from hyperlink


futrose

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.