Jump to content

Recommended Posts

Hello,

 

I have a survey that i am doing, and one of the questions is pick your top two questions out of  six answers.  When I submit the form how do I know what check boxes they click and how do I know if they clicked three instead of two??

 

Thank you... here is my code for the question

 

    <tr>

        <td width="33%"><font face="Arial">

        <input type="checkbox" name="C6" value="ON"><font size="2"> Hospital

        newsletter</font></font></td>

      </tr>

      <tr>

        <td width="33%"><font face="Arial">

        <input type="checkbox" name="C7" value="ON"><font size="2"> Posters/Tent

        Cards</font></font></td>

      </tr>

      <tr>

        <td width="33%"><font face="Arial">

        <input type="checkbox" name="C8" value="ON"><font size="2"> Awareness

        Website</font></font></td>

      </tr>

      <tr>

        <td width="33%"><font face="Arial">

        <input type="checkbox" name="C9" value="ON"><font size="2"> Energy

        Newsletter</font></font></td>

      </tr>

      <tr>

        <td width="33%"><font face="Arial">

        <input type="checkbox" name="C10" value="ON"><font size="2"> Displays</font></font></td>

      </tr>

      <tr>

        <td width="33%"><font face="Arial">

        <input type="checkbox" name="C11" value="ON"><font size="2"> Intranet</font></font></td>

      </tr>

do something like:

 

if(isset($_POST['C6'])) {
  $checboxes_set + 1;
}

if(isset($_POST['C7'])) {
  $checboxes_set + 1;
}

if(isset($_POST['C8'])) {
  $checboxes_set + 1;
}

if(isset($_POST['C9'])) {
  $checboxes_set + 1;
}

if(isset($_POST['C10'])) {
  $checboxes_set + 1;
}

if(isset($_POST['C11'])) {
  $checboxes_set + 1;
}

echo "ammount of echboxes set: $cechkboxes_set";

I changed the code a bit.. but mostly the code you gave me... but it won't print anything out... the $total variable won't display.  did I mess upo the code??

 

Rich

 

if(isset($_POST["C1"])) {

  $total + 1;

}

 

if(isset($_POST["C2"])) {

$total + 1;

}

 

if(isset($_POST["C3"])) {

$total + 1;

}

 

 

if(isset($_POST["C4"])) {

$total + 1;

}

 

 

echo "<br>"; echo "<br>"; echo "<br>"; echo "<br>";

echo "$total";

Ok.....  maybe i asked the wrong question.

 

I want to take each text box that was checked, add each value of the textbox together in one string varaible seperated by a comma.  Once I have that string variable I am going to insert it into a database field.

 

Thx,

Rich

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.