Question

I am currently stuck on how to use $_GET from a hyperlink and send it to another php page for processing. I have 2 php pages. The first page, we'll call it page1.php, gets user input (customerID) from a HTML page through a textbox and according to that id, goes into the database and finds relative information such as the Customer Name and the Address etc using logical joins.

$id = $_GET['custID']; //This is to obtain the input from the HTML page.

I have that working perfectly.

My next task is to create another php page, we'll call it page2.php, in where i am required to output only the customerID and the customerName, and from there i am required to hyperlink every record in the Customer ID row which references to page1.php and when the user clicks any of those links, it should only show information according to that customerID in a table.

So far i can make each record in the Customer ID row link to page1.php but i am unable to output any results.

<?php 
while ($row = mysql_fetch_array($rs)) { ?> 
<tr> 
<td><?php echo $row["customerName"]?></td> 
<td><?php echo "<a href='page1.php?'>{$row["custID"]}</a>"?></td> 
</tr> 
<?php } 

Any help would be much appreciated.

Was it helpful?

Solution

Change the link to following

 <?php echo '<a href="page1.php?custID='.$row["custID"].'">'.$row["custID"].'</a>';?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top