radio button or list/menu
Posted: Tue Jan 13, 2009 9:20 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
hi everyone. im new in php. i am designing a survey application using php and mysql...
i have a problem with radio button and list/menu.
here is my code.. i have a problem how will i insert the looped radio or list menu to the database. will i make an array for this... pls help me.........
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
hi everyone. im new in php. i am designing a survey application using php and mysql...
i have a problem with radio button and list/menu.
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="800" border="1" cellpadding="0" cellspacing="0">
<form id="form1" name="form1" method="post" action="main.php">
<tr>
<td width="132">Control No.:</td>
<td width="144">
<input type="text" name="ctrl_no" id="ctrl_no" /> </td>
<td width="183"> </td>
<td width="155"> </td>
<td width="174"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php while($r_cat = mysql_fetch_assoc($result)) { ?>
<tr>
<td> </td>
<td><?php echo $r_cat['cat_name'];?>
<input name="dept_id" type="hidden" id="dept_id" value="<?php echo $r_cat['dept_id'];?>" />
<input name="cat_id" type="hidden" id="cat_id" value="<?php echo $r_cat['cat_id'];?>" /> </td>
<td>
<select name="score" id="score">
<option value=" " selected="selected"> </option>
<?php $q_score = "select * from score";
$score_result = mysql_query($q_score) or die(mysql_error());
while($r_score = mysql_fetch_assoc($score_result)){
if($r_score['score_id'] == 'score_id')
{
$selected = " selected";
}
else
{
$selected = "";
}
echo '<option value="'. $r_score['score_id'] . '"'.$selected.'>'. $r_score['comm_name'].
'</option>'."\r\n";
} ?>
</select> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="radio" name="score2" id="radio" value="3" />Delighted</td>
<td><input type="radio" name="score2" id="radio" value="1.5" />Satisfied</td>
<td><input type="radio" name="score2" id="radio" value="-2" />Disappointed</td>
</tr><?php }//end while ($r_cat = mysql_fetch_assoc($result)) ?>
<tr>
<td> </td>
<td><input type="submit" name="Post" id="Post" value="Post" /></td>
<td><input type="submit" name="Cancel" id="Cancel" value="Cancel" /></td>
</tr>
</form>
</table>
</body>
</html>here is my code.. i have a problem how will i insert the looped radio or list menu to the database. will i make an array for this... pls help me.........
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: