How do I display the state of a radio button?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am using a PHP/HTML form to access a MySql database. Some of the entries
use radio buttons.

    <td><input name="Flag1" type="radio" value="1" /></td>
    <td><input name="Flag1" type="radio" value="2" /></td>
    <td><input name="Flag1" type="radio" value="3" /></td>
    <td><input name="Flag1" type="radio" value="4" /></td>

This part works fine. I have created a form to permit the operator to edit
a record. This form is identical to the input form and displays the data
for the record selected. What I can't figure out how to do is to display
the data in the radio button fields. The PHP script correctly returns the
data but I don't know how to check the correct button. It seems like this
would be a pretty common thing, but I haven't been able to find it.

Any help will be greatly appreciated.

Re: How do I display the state of a radio button?

Quoted text here. Click to load it

$string = $_SERVER["HTTP_ACCEPT"];
$myxml=stristr($string, 'application/xhtml+xml');
if($myxml === FALSE) {
header("Content-Type:text/html; charset=utf-8");
else{ header("Content-Type:application/xhtml+xml;charset=utf-8");
print "<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
" ">
<html xmlns=" ">
<meta http-equiv="content-type" content=
"text/html; charset=utf-8" />
<? if($_POST){print "<p>Flag1 " .$_POST['Flag1']. " data checked</p>";} ?>
<form action="" method="post">
<table summary="">
<td><input name="Flag1" type="radio" value="1"
<? if($_POST['Flag1']=='1'){print ' checked="checked" ';} ?>/></td>
<td><input name="Flag1" type="radio" value="2"
<? if($_POST['Flag1']=='2'){print ' checked="checked" ';} ?>/></td>
<td><input name="Flag1" type="radio" value="3"
<? if($_POST['Flag1']=='3'){print ' checked="checked" ';} ?>/></td>
<td><input name="Flag1" type="radio" value="4"
<? if($_POST['Flag1']=='4'){print ' checked="checked" ';} ?>/></td>
<td colspan="4"><input type="submit" value="test" /></td>

BootNic   Thursday, November 02, 2006 12:15 PM

"The POP3 server service depends on the SMTP server service, which
failed  to start because of the following error: The operation
completed  successfully."
*Windows NT Server v3.51*

Site Timeline