Jump to content

How to use both checkboxes and radio buttons!


Recommended Posts



I am in need of urgent help! I am a complete noobie to php and I am trying to use both checkboxes and radio buttons.  At the moment, I have found a code that will display my questions w/ radio buttons.  I need to be able to make use of checkboxs also but don't know how to.  The reason being is that I am trying to display my questions one by one with different question types.  Please, some1 help!  The code is as follows:








die("Could not connect: ".mysql_error());


if(!isset($recordi)) $recordi = 0;

$result = mysql_query("select * from topic_content limit $recordi, 1")

or die("Select topic_content error! : ".mysql_error());

$row = mysql_fetch_row($result);

$qutypes = $row[2];

if(!empty($row[3])) $question = $row[3];



echo "no more question!";



if(!empty($row[4])) $choice1 = $row[4];

if(!empty($row[5])) $choice2 = $row[5];

if(!empty($row[6])) $choice3 = $row[6];

if(!empty($row[7])) $choice4 = $row[7];

if(!empty($row[8])) $choice5 = $row[8];

if(!empty($row[9])) $choice6 = $row[9];




<html xmlns="http://www.w3.org/1999/xhtml">


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />






<input type="hidden" name="recordi" value="<?=$recordi?>">

<?php echo "$question"; ?><br>

<?php if(!empty($choice1)) buttonShow($qutypes); ?> <?php if(!empty($choice1)) echo "$choice1"; ?><br>

<?php if(!empty($choice2)) buttonShow($qutypes); ?> <?php if(!empty($choice2)) echo "$choice2"; ?><br>

<?php if(!empty($choice3)) buttonShow($qutypes); ?> <?php if(!empty($choice3)) echo "$choice3"; ?><br>

<?php if(!empty($choice4)) buttonShow($qutypes); ?> <?php if(!empty($choice4)) echo "$choice4"; ?><br>

<?php if(!empty($choice5)) buttonShow($qutypes); ?> <?php if(!empty($choice5)) echo "$choice5"; ?><br>

<?php if(!empty($choice6)) buttonShow($qutypes); ?> <?php if(!empty($choice6)) echo "$choice6"; ?><br>







Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.