deluxenathan deluxenathan - 10 months ago 27
SQL Question

PHP - Data not being transferred to next page

I have the following code below which is meant to keep the $_SESSION value when its goes to the next PHP page 'individual_item_page.php'

NOTE: I have hard coded the longitude & latitude for the SQL query

<table class="center">
$LOCATION = $_POST['location'];
$result = $conn->prepare("SELECT dog_park_name,3956*2*ASIN(SQRT(POWER(SIN((-27.318672099999997 - latitude)*pi()/180/2),2)+COS(19.286558 * pi()/180)
*COS(latitude * pi()/180)*POWER(SIN((152.8500067 -longitude)* pi()/180/2),2)))
as distance FROM dog_parks.items having distance < $LOCATION ORDER BY distance;");
for($i=0; $row = $result->fetch(); ){
$_SESSION["LOCATION".$i] = $row[0];
<tr><!-- Adding the first table row -->
<th>Dog Park</th><!-- Adding the table header -->
<tr><!-- Adding the second table row -->
<a href="individual_item_page.php?location='<?php $row[$i] ?>' " >
<?php echo $row[$i] ?>
<?php } ?>

Here is the result in the URL when the script is executed.
Only showing "

I'm thinking it is because there are multiple items being selected in the SQL query eg: dog_park_name,longitude and latitude.

I need only for the dog_park_name to be followed across to the next page...

Any ideas?


The porblem is that you are not echoing your $row[$i].


<a href="individual_item_page.php?location='<?php $row[$i] ?>' " >


<a href="individual_item_page.php?location='<?= $row[$i] ?>' " >