I am trying to programmaticall y set a radio button in a table of radio
buttons. I have two problems with the code below:
1 - I can not prepare the <Formstatemen t to be printed by php.
(syntax of the hyphens, quotes) my fault!
2 - If I delete the <Formand </Formstatements I can build the table
of radio buttons correctly, HTML wise. The fifth radio button has
'checked=True'. The problem is even though I set radio button 5 to be
checked only the last radio button is checked when it is displayed on
the screen. But viewing the page code says it should be the fifth radio
button.
Anybody have some ideas, I'm lost.
<?php
/**
Http://localhost/quotes/scrap.php?XD...RT=tswebeditor
*/
if(isset($_POST['abbr_letter']) ) {
$selectedNum = $_POST['abbr_letter'];
}
else {
$selectedNum = 1;
}
$value = 0;
$checked = 'false';
$selectedNum = 5;
$ColumBrake = 13;
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">';
print '<html xmlns="http://www.w3.org/1999/xhtml">';
print '<HTML>';
print '<HEAD>';
print '<title>Testiin g radio Buttons</title>';
print '<link href="quotes.cs s" rel="stylesheet " type="text/css">';
print '<SCRIPT language=JavaSc ript src="quotesCss. js"
type="text/javascript"></SCRIPT>';
// print '<b><FORM NAME="author_ab brv" method="POST" action="'.<?php
echo $_SERVER['PHP_SELF'];?>.'"></b>';
print '</HEAD>';
print '<table><tbody> <tr>';
foreach (range('A', 'Z') as $letter)
{
if( $value == $ColumBrake) {
print '</tr><tr>';
}
if( $value == $selectedNum) {
$checked = 'true';
print '<td><input type="radio" name="abbr_lett er" value="'.
$value .'" checked="'. $checked .
'" onclick="submit ()" />'.$letter.'</td>';
} else {
$checked = 'false';
print '<td><input type="radio" name="abbr_lett er" value="'.
$value .'" checked="'. $checked .
'" onclick="submit ()" />'.$letter.'</td>';
}
$value = $value +1;
}
print '</tr></tbody></table>';
// print '</FORM>';
print '</HTML>';
?>
--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)