variable not printing with GET statement
Posted: Tue Feb 24, 2009 3:45 pm
I have the following code on my index page that 'dynamically' creates a link to the prod_detail page (second set of code following):
I pass the code above to the code below (on another page) using the GET command:
but it doesn't seem to work? The pro_detail.php page opens, but '$item_short_desc' does not echo (print)??
In case you need to see it, I have the more of my index page listed below (where I get my 'item_short_desc' variable from):
Code: Select all
<A HREF=\"$sitelocation" . "$item_url" . "?" . "item_short_desc\">Code: Select all
<?php
$item_short_desc = $_GET['item_short_desc'];
//$name = $_GET['name'];
echo($item_short_desc);
?>In case you need to see it, I have the more of my index page listed below (where I get my 'item_short_desc' variable from):
Code: Select all
<?php
$total_items = "SELECT * FROM poj_products";
$result = mysql_query($total_items);
$number_of_rows=mysql_num_rows($result);
?>
<?php
if (isset($_POST['start_view'])) {
$start_view = $_POST['start_view'];
}else{
$start_view = 0;
}
if (isset($_POST['previews_per_page'])){
$items_to_view = $_POST['previews_per_page'];
}else{
$items_to_view = 12;
}
?>
<?php
$num_pages = $number_of_rows/$items_to_view;
$num_pages = ceil($num_pages);
?>
<?php
$get_items = "SELECT * FROM poj_products LIMIT $start_view,$items_to_view";
$get_items = mysql_query($get_items);
echo "<CENTER>";
echo "<TABLE WIDTH=\"90%\" CELLSPACING=\"10\">";
echo "<TR>";
$rowbreaks = 1;
while($item_row = mysql_fetch_array($get_items)){
$item_short_desc = $item_row['short_desc'];
$item_url = $item_row['url'];
$item_img = $item_row['img'];
$item_prod_name = $item_row['prod_name'];
$item_prod_code = $item_row['prod_code'];
$item_retail = $item_row['retail'];
//list($width, $height) = getimagesize($item_lnk);
//if($width > 200){
//
//}else{
//
//}
echo "<TD class=\"preview-images\" VALIGN=\"top\" WIDTH=\"25%\">
<CENTER><A HREF=\"$sitelocation" . "$item_url" . "?" . "item_short_desc\">
<IMG SRC=\"includes/img_resize3.php?src=$sitelocation$item_img&width=144&height=144&qua=50\" BORDER=\"0\"></A>
<b>$item_prod_name</b>
<HR></CENTER>
$item_short_desc
<BR><BR>
$item_prod_code
<BR>
<B>$item_retail</B></P>
<BR></TD>";
if($rowbreaks == 4){
echo "</TR><TR>";
$rowbreaks = 0;
}
$rowbreaks++;
}
echo "</TR>";
echo "</TABLE>";
echo "</CENTER>";
?>