I have a page that dynamically names a radio button. I then have a page that I want to be able to grab that value into a variable but I don't know how to refer to the button. See my code below:
This is the code on the first page. The radio button that is inside the second for loop is the field that I want dynamically named.
for($i = 0; $i < $commrows; ++$i)
{
$commline = odbc_fetch_array($commresu
lt); ?>
<input type='checkbox' name='commtopic[]' value='<?PHP echo $commline[Topic] ?>' onClick="expandcontent('<?
PHP echo $num ?>')">
<?PHP echo $commline[Topic]; ?> <br>
<div id="<?PHP echo $num ?>" class="switchcontent"><blo
ckquote>
<?PHP
$ratingcommquery = "SELECT * FROM tblReviewItems WHERE Category = 'Communication' AND Topic = '$commline[Topic]'";
$ratingcommresult = odbc_exec($connect,$rating
commquery)
or die("Query Failed.");
$ratingcommrows = odbc_num_rows($ratingcommr
esult);
for($j = 0; $j < $ratingcommrows; ++$j)
{
$ratingcommline = odbc_fetch_array($ratingco
mmresult);
?>
<input type='radio' name='<?PHP echo $commline[Topic] ?>' value='<?PHP echo $ratingcommline[Rating] ?>'"><?PHP echo $ratingcommline[Rating] ?><br><?PHP
}
?>
</blockquote></div>
<?PHP
}
This is the code on the second page that I am trying to grab the data:
$commtopic = $_REQUEST['commtopic'];
$commratingname = $commtopic;
$commrating = $_REQUEST["$commratingname
"];
print "commrating $i is $commrating<br>";
I've also tried:
$commrating = $_REQUEST[$commratingname]
;
$commrating = $_REQUEST['$commratingname
'];
Can someone please point me in the right direction?
Thanks
Start Free Trial