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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.