This should work. It only does when $stat_check is equal to the values of the radiobuttons, and not sth else. if it is, none of the buttons will be checked.
<?
$stat_check = "Pending";// $myrow["status"]; //place right variable here
function printRadios($toPrint) {
$returnValue = "";
for ($i = 0; $i < sizeof($toPrint); $i++) {
$returnValue .= "<input type=radio name=status value=".$toPrint[$i]."> <b>".$toPrint[$i]."</b> \n";
}
return $returnValue;
}
$completeButtons = printRadios(array("New", "Accepted", "Pending", "Denied"));
$completeButtons = str_replace("value=".$stat_check, "value=".$stat_check." checked", $completeButtons);
echo $completeButtons;
?>