radiobutton
Posted: Wed Aug 13, 2003 11:11 pm
can anybody show me a example to handle radiobutton in a html form
from a seperate php file? thanks
I'm a newer for php.
from a seperate php file? thanks
I'm a newer for php.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<form name="myform" method="post" action="radio.php">
<input type="radio" name="radio" value="radio 1" checked="checked">
<input type="radio" name="radio" value="radio 2">
<input type="radio" name="radio" value="radio 3">
<input type="radio" name="radio" value="radio 4">
</form>Code: Select all
<?
echo "$radio";
?>Code: Select all
<form action="UProduct.php" method="post" name="Product" target="_self">
...
<tr>
<td><strong>Grade</strong></td>
<td><p>
<?
$Get = "SELECT GRADE, NAME FROM GRADES ORDER BY GRADE";
$result = mysql_query($Get,$DB)
or die("SELECT Query failed");
$count = mysql_num_rows($result);
for($n=0; $n< $count; $n++ ) {
$res = mysql_fetch_object($result);
print '<label><input type="radio" name="Grade" value="'.$res->GRADE.'"';
if ($res->GRADE == $Grade)
print " checked";
print ">$res->NAME</label>\n";
};
?>
<br>
</p></td>
</tr>
...
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>Code: Select all
$SQL = 'UPDATE PRODUCTS SET
GRADE='.strip_tags(substr($_POSTї"Grade"],0,4)).',
WHERE PRODUCT_ID = '.$_POSTї'ID'];Code: Select all
<?
// if register_globals = off, this wont work:
echo "$radio";
// but this will:
echo $_POSTї'radio'];
?>