Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6135721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:30:48+00:00 2026-05-23T17:30:48+00:00

I am working on a form that contains multiple checkboxes (each with its own

  • 0

I am working on a form that contains multiple checkboxes (each with its own value). The last checkbox is marked “Other” and, when it is checked, a text input should appear to let the user write his/her own value.

<input name="pVital[]" type="checkbox" id="pVital[]" value="I &amp; O" />I &amp; O<br/>
<input name="pVital[]" type="checkbox" id="pVital[]" value="Daily Weight" />Daily Weight<br/>
<input name="pVital[]" type="checkbox" id="pVital[]" value="Foley Catheter" />Foley Catheter<br/>
<input name="pVital[]" type="checkbox" id="pVital[]" onClick="showHide(whatever);" value="" />Other<br/>
<input name="pVital[]" type="text" id="whatever" style="visibility: hidden;" />

I insert all these values into the same field in my database, as an array of strings, using php’s implode function:

if ((isset($_POST['pVital']))){
    array_walk($spVital, 'GetSQLValueString');
    $spVital = implode(',',$_POST['pVital']);   
}

$insertSQL = sprintf("INSERT INTO admissionorder (VitalSigns) VALUES (%s)",
                      GetSQLValueString($spVital, "text"));

mysql_select_db($database_PPS, $PPS);
$Result1 = mysql_query($insertSQL, $PPS) or die(mysql_error());

This is working fine for insertion, but I encounter a problem in retrieving these checkboxes… with the “other” text input if appropriate.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:30:48+00:00Added an answer on May 23, 2026 at 5:30 pm

    This did it for me:

    <?php 
        $pvitals = explode('|', $row_pInfoRecordset['VitalSigns']);
    ?>
    

    then:

    <input name="pVital[]" type="checkbox" id="pVital[]" value="I &amp; O" checked="<?php if (in_array('I &amp; O', $pvitals)) echo "checked"; else echo "unchecked"; ?>" />I &amp; O<br/>
      <input <?php if (in_array('Daily Weight', $pvitals)) echo "checked"; else echo "unchecked";  ?> name="pVital[]" type="checkbox" id="pVital[]" value="Daily Weight" />Daily Weight<br/>
      <input <?php if (in_array('Foley Catheter', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="pVital[]" value="Foley Catheter" />Foley Catheter<br/>
      <input <?php if (in_array('other', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="other" onClick="showHide(whatever);" value="other" />Other<br/>
        <input name="pVital[]" type="text" id="whatever" <?php if (in_array('other', $pvitals)) { $vis = 'style="visibility: visible;"'; echo $vis; ?> <?php } else { ?> style="visibility:hidden" <?php } ?>  value="<?php if (in_array('other', $pvitals)) echo end($pvitals); ?>">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a codeigniter form that contains two checkboxes: <input type=checkbox checked=checked id=box1 name=box1
In the project I'm working on, there is a certain form that contains an
I am working with QT Creator. I have a form that contains a push
I am working on a contact form that is not posting my multiple selection
I'm working on a Form that contains a datagridview and textbox, I need the
I'm working on a form that will display links to open different types of
I am working on a form that adds employee information to a MySQL table
I'm working on a long form that has several radio button groups. At the
Im trying to get a form working in Internet Explorer. I see that when
Im working with a shopping cart plugin and that uses a basic form on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.