PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Sep 20, 2018 6:44 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jan 13, 2009 10:20 am 
Offline
Forum Newbie

Joined: Tue Jan 13, 2009 10:15 am
Posts: 2
~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: :arrow: 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.
Syntax: [ Download ] [ Hide ]
<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">&nbsp;</td>
    <td width="155">&nbsp;</td>
    <td width="174">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  <td>&nbsp;</td>
   <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <?php while($r_cat = mysql_fetch_assoc($result)) { ?>
  <tr>
    <td>&nbsp;</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>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
 
  <tr>
    <td>&nbsp;</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>&nbsp;</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: :arrow: Posting Code in the Forums to learn how to do it too.


Top
 Profile  
 
PostPosted: Tue Jan 13, 2009 10:43 am 
Offline
Forum Newbie

Joined: Tue Jan 13, 2009 10:15 am
Posts: 2
to simplify things.. this is how my survey looks like.
note: the '0's bellow is the radio button

category comment
security 0delighted 0satisfied 0disappointed
bell service 0delighted 0satisfied 0disappointed
parking 0delighted 0satisfied 0disappointed



how will i insert the value of these radio button in the dbase?? the category column came from the database and so as the comment..

can someone help me how will i insert the value of the radion button in the database. i tried to insert it and it inserts a 0 value..


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group