Hi,

I'm displayin data in my database in a table form using a for loop . In my loop i added a radiobutton so that a selected radio button would identify the row on the table. This is the code is used:

for($j=0;$j<=$nrows2;$j++){
		while($row = mysql_fetch_row($result)){
               
                print "<tr><td>".$row [0]."</td><td>".$row [1]."</td><td>".$row [2]."</td><td><input type=radio name=".$j." value=".$j."</td></tr>";
				
            }
			}

My problem is i tried the following code hoping it would identify which radiobutton was selected but it is non responsive

if(isset($_POST['ed']))
				{
	
	echo $_POST[$j];
	
			}

Thanks.

The value and names of your radio buttons are going to be numbers, not names (or text).

//This will not do anything for you:
if(isset($_POST['ed']))

hi

the POST is for the button. i wanted to test if it would display the value of radio button that was checked but it didnt display anything

hi

the POST is for the button. i wanted to test if it would display the value of radio button that was checked but it didnt display anything

:) Sorry 'bout that, I assumed it was for one of the radios ...

i thought that echoing $_POST[$j] would display the selected radio button but it doesnt n' i'm fresh out of ideas

If the variable $j is holding a value it should echo.

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.