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'];

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")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.