Here's what I'm trying to do. I have a php script that will run an sql query and return the data back in a table.

I want to put a radio button into each row so the user can select one row to submit. Then, when they click submit, I need all of the data in that row to be passed to another php page.

I have no idea how to do it...

I've got the radio buttons inserted into each row, but I'm stuck on how to submit the row data.

Any help would be greatly appreciated.

This is what I think you want to do.
Database name: business
Table name: customers
The customer table has the following fields:
id (Unique id assigned to each customer)
first_name (First name of customer)
last_name (Las name of customer)
age (Customer's age)
I have two pages customer_list.php and customer_details.php
The first page, customer_list.php, displays all customers in the customers table. Tha second page, customer_details.php, displays the full details of a customer based on the selection made on the customer_list.php page. The codes for the two pages are below.

customer_list.php

<?php
$connection = mysql_pconnect("localhost", "root", "password") or die ("Error connection. ".mysql_error());
mysql_select_db("business", $connection) or die("Error selecting db. ".mysql_error());

	$query = "SELECT * FROM customers ORDER BY id";
	$result = mysql_query($query) or die("Error processing query. ".mysql_error());

	echo "<form method = 'post' action = 'customer_details.php'>";
	echo "<table width = '50%' border = '1'>";
	echo "<tr>";
		echo "<td></td>";
		echo "<td>PERSONNEL ID</td>";
		echo "<td>FIRST NAME</td>";
		echo "<td>LAST NAME</td>";
		echo "<td>AGE</td>";
	echo "</tr>";
	while($person = mysql_fetch_object($result))
	{
		echo "<tr>";
			echo "<td><input type = 'radio' name = 'id' value = '".$person->id."'></td>";
			echo "<td>$person->id</td>";
			echo "<td>$person->first_name</td>";
			echo "<td>$person->last_name</td>";
			echo "<td>$person->age</td>";
		echo "</tr>";
	}
	echo "<tr><td colspan = '5' align = 'center'><input type = 'submit' name = 'go' value = 'GO'></td></tr>";
	echo "</table>";
	echo "</form>";

?>

customer_details.php

<?php

	echo "ID RECEIVED : ".$_POST['id'];
	//NOW YOU CAN USE THE VALUE STORED IN $_POST['id'] TO QUERY YOUR 
	//DATABASE FOR ANY INFORMATION RELATING TO THE VALUE STORED IN $_POST['id']
	//For example, to get all information about this specific id as on the
	//customer_list.php page, you would do something like this:
	
	$connection = mysql_pconnect("localhost", "root", "password") or die ("Error connection. ".mysql_error());
	mysql_select_db("business", $connection) or die("Error selecting db. ".mysql_error());

	$query = "SELECT * FROM customers WHERE id = '".mysql_real_escape_string($_POST['id'])."'";
	$result = mysql_query($query) or die("Error processing query. ".mysql_error());
	$person = mysql_fetch_object($result);
	
	echo "<table border = '1' cellpadding = '4' cellspacing = '4'>";
		echo "<tr><td align = 'center' colspan = '2'><b>CUSTOMER DETAILS</b></td></tr>";
		echo "<tr><td align = 'right'>CUSTOMER ID </td><td><b>$person->id</b></td></tr>";
		echo "<tr><td align = 'right'>FIRST NAME </td><td><b>$person->first_name</b></td></tr>";
		echo "<tr><td align = 'right'>LAST NAME </td><td><b>$person->last_name</b></td></tr>";
		echo "<tr><td align = 'right'>AGE </td><td><b>$person->age</b></td></tr>";
	echo "</table>";

?>
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.