Radio Buttons
Posted: Wed Dec 21, 2005 10:24 pm
hi all !
im supposed to edit a form and in that form there is a radio button as well. im not sure how to retrive the value of the radio button from database. kindly help. the code is given below: i couldnt get the value of the radio button. the database table structure is also given below:
database structue:
CREATE TABLE `objective` (
`hw_id` int(11) NOT NULL default '0',
`orig` text NOT NULL,
`ach` text NOT NULL,
`nach` text NOT NULL,
`indi` text NOT NULL,
`kl` char(3) NOT NULL default '0'
) TYPE=MyISAM;
im supposed to edit a form and in that form there is a radio button as well. im not sure how to retrive the value of the radio button from database. kindly help. the code is given below: i couldnt get the value of the radio button. the database table structure is also given below:
Code: Select all
<?php
include('header.inc');
$_SESSION['iddd']=$_GET['id1'];
if(isset($_GET['id1'])) {
require_once('mysql_connect.php');
$query="SELECT * from objective WHERE hw_id={$_GET['id1']}";
$result=@mysql_query($query);
$row=mysql_fetch_array($result);
}
if(isset($_POST['submit']))
{ require_once('mysql_connect.php');
$i=$_POST['iii'];
$abc=$_POST['orig'];
$mno=$_POST['kl'];
$sql="UPDATE objective SET orig='$abc',ach='$def',nach='$ghi',
indi='$jkl',kl='$mno' WHERE hw_id='$i'";
$result=@mysql_query($sql);
if($result) { echo 'Your Report is updated, ';
echo "Click Next to continue with editing";
$url1="edits3.php?id1=$i "; ?>
<button onClick="window.location='<?php echo $url1;?>'">Next>></button>
<?php include ('footer.inc');
exit();}
}
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<fieldset><legend><font size="4" color="blue">OBJECTIVE ACHIEVEMENT
</font</legend>
<input type="hidden" name="iii" VALUE="<?php echo $row['hw_id'] ?>"/>
<table width="100%" bgcolor="#d0d8ea">
<tr><td><font face="Arial" size="3"><b>1. Original Project Achievement</b><br><font face="Times" size="3" color="blue"><i>(State the specific project objectives as described in proposal)</i><br>
<p><textarea name="orig" rows="4" cols="70" align="center">
<?php echo $row['orig']; ?>
</textarea></p>
<hr></td></tr>
<tr><td><font face="Arial" size="3"><b>5. How would you characterize the quality of this output ? </b><br><br>
<? echo $mno; ?>
<input name="kl" type="radio" value="sig"<? echo $mno; ?><?=($mno=='sig') ? ' checked' : '' ?> />Significant breakthrough <br>
<input name="kl" type="radio" value="maj"<? echo $mno; ?><?=($mno=='maj') ? ' checked' : '' ?> />Major improvement <br>
<input name="kl" type="radio" value="min"<?=($mno=='min') ? ' checked' : '' ?> />Minor improvement <br><HR>
</td></tr>
</table>
<div align="center"><input type="submit" name="submit" value="UPDATE REPORT"/> </div>
</form>CREATE TABLE `objective` (
`hw_id` int(11) NOT NULL default '0',
`orig` text NOT NULL,
`ach` text NOT NULL,
`nach` text NOT NULL,
`indi` text NOT NULL,
`kl` char(3) NOT NULL default '0'
) TYPE=MyISAM;