Charles White Charles White - 6 months ago 18
HTML Question

Passing variables to another page using $_GET not working

$_GET
is not working when passing variables from one page to another page.

Title - ID - Embed are all showing in the URL on page two, so I don't think the problem is on page 1 being that is appears to be passing the variables.

The $_GET['embed'] value is appearing on page 2 but not for $_GET['id'] and $_GET['title']

Page 1 Code:

$title = $row['title'];
$id = $row['id'];
$linkurl = $row['embed'];
$src1 = $row['thumbs1'];
echo '<a href="show/video_show.php?title='.$title.'&id='.$id.'&embed='.$linkurl.'"><img height="160" width="260" style="border:none;" src="'. $src1 .'" /></a>';


Page 2 Code:

Title: <? echo $_GET['title']; ?>
<iframe src="<?php echo $_GET['embed'];?>"allowfullscreen="allowfullscreen" scrolling="no" width="770" height="440"></iframe>
<p>Video Number: <? echo $_GET['id'];?>
<!-- embed is working -->

Answer

You have issue in your PAGE 2 file :

Replace <? with <?php

Title: <?php echo $_GET['title']; ?>  // changed
<iframe src="<?php echo $_GET['embed'];?>"allowfullscreen="allowfullscreen" scrolling="no" width="770" height="440"></iframe>
<p>Video Number: <?php echo $_GET['id'];?> //changed
 <!-- embed is working -->
Comments