0

I am just trying to link a reference numbers using php/mysql

1) Each reference number will select (see code)

2) Post that number to next page and query the info.

How can I post reference ID and query in the page 2.

<?
// Page 1 refno.php

$cid= $_SESSION["c_id"];

extract($_POST);

echo "Receipts <br><br>";
$sql=mysql_query("SELECT DISTINCT r_ref FROM reserve where c_id='$cid'") or die (mysql_error());

while($row = mysql_fetch_array($sql)){
	echo  "<a href=ref.php>".  $row['r_ref']. "</a>"; // post 1001 number to Page 2
	echo "<br>";
}
?>

//page 2

$sql=mysql_query("SELECT * FROM reserve WHERE r_ref=1001") or die (mysql_error());
$result = mysql_fetch_array($sql);
echo'Payment:<br> '. $result['r_pay'];
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Boskor
0

I am just trying to link a reference numbers using php/mysql

1) Each reference number will select (see code)

2) Post that number to next page and query the info.

How can I post reference ID and query in the page 2.

<?
// Page 1 refno.php

$cid= $_SESSION["c_id"];

extract($_POST);

echo "Receipts <br><br>";
$sql=mysql_query("SELECT DISTINCT r_ref FROM reserve where c_id='$cid'") or die (mysql_error());

while($row = mysql_fetch_array($sql)){
	echo  "<a href=ref.php>".  $row['r_ref']. "</a>"; // post 1001 number to Page 2
	echo "<br>";
}
?>

//page 2

$sql=mysql_query("SELECT * FROM reserve WHERE r_ref=1001") or die (mysql_error());
$result = mysql_fetch_array($sql);
echo'Payment:<br> '. $result['r_pay'];

If I understand you correctly, than you want to have on first page 1000 different numbers and when you click on each number you will get more details on another page.

You have to add:

$ref=$row['r_ref'];
echo "<a href=\"ref.php?ref=".urldecode($ref)."\">$ref</a>";

and than on second page:

$ref=($_GET['ref']);
$sql=mysql_query("SELECT * FROM reserve WHERE r_ref=$ref")
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.