i'm looking to create a table that contains as the first column a radio box, following a row of extracted data from my database. Below is the piece of code that will produce my table: echo '<TABLE BORDER="1" CELLPADDING="4" CELLSPACING="2">'; echo '<TR><TD>Check</TD><TD>Unit Name</TD><TD>Unit Part No</TD><TD>Description</TD><TD>Part No</TD></TR>'; extract($rows); echo "<TR><TD><INPUT TYPE=radio NAME=\"radio\" VALUE=\"$gid\"/></TD><TD$unitname</TD><TD> $unitpartno</TD><TD$description</TD><TD>$partno</TD></TR>"; while($rows = @mysql_fetch_array($result)) { extract($rows); echo "<TR><TD><INPUT TYPE=radio NAME=\"radio\" VALUE=/></TD><TD>$unitname</TD><TD>$unitpartno</TD><TD>$description </TD><TD>$partno</TD></TR>"; } echo '</TABLE>'; PHP: Now, what i'm trying to accomplish, is when the user selects a certain radio box, i need to extract the row of data that is associated with that radio box. Could someone please give me a hand.
Why are you using \" you can use ' it is cleaner example echo "<tr><td><input type='radio' NAME='radio'... "; also when having a var use ".$var."
Hey do the data come from the single database? If this is the condition the again retrive the data from the database. If you donot want this you can use hidden fields to store the data. eg. <input type='hidden' name='unitname<?=$gid?>' value='<?=$unitname?>'> Then on the processing page you can get value by $val = $_POST['unitname'.$_POST['radio']] Have fun.;-)
Are you talking about as soon as the radio button is selected or after they hit the sumbit button, because php is server side and they will have to hit that submit button in order to extract right then and there, but if you use some javascript and maybe an iframe it could be done.