Displaying text boxes from a check box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chimambo@googlemail.com

    Displaying text boxes from a check box

    I want to make visible two or more text boxes once a user has ticked
    a checkbox. I know javascript will come in here, but am a newbie.
    However, I want to maintain the variables and move them back to PHP
    for updating in the relevant tables. Can anyone please give me ideas.
  • SrSilveira

    #2
    Re: Displaying text boxes from a check box

    On Mar 7, 9:53 am, chima...@google mail.com wrote:
    I want to make visible two or more text boxes once a user has ticked
    a checkbox. I know javascript will come in here, but am a newbie.
    However, I want to maintain the variables and move them back to PHP
    for updating in the relevant tables. Can anyone please give me ideas.
    this?
    <?
    if (isset($_POST['field'])){
    ?>
    <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
    <?
    }
    ?>

    Comment

    • Jerry Stuckle

      #3
      Re: Displaying text boxes from a check box

      chimambo@google mail.com wrote:
      I want to make visible two or more text boxes once a user has ticked
      a checkbox. I know javascript will come in here, but am a newbie.
      However, I want to maintain the variables and move them back to PHP
      for updating in the relevant tables. Can anyone please give me ideas.
      >
      As you said, you need javascript to do it. Try a javascript newsgroup
      such as comp.lang.javas cript.

      All PHP sees is what's submitted in the request. It doesn't matter how
      that data is generated.

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Rik Wasmus

        #4
        Re: Displaying text boxes from a check box

        On Fri, 07 Mar 2008 13:53:03 +0100, <chimambo@googl email.comwrote:
        I want to make visible two or more text boxes once a user has ticked
        a checkbox. I know javascript will come in here, but am a newbie.
        However, I want to maintain the variables and move them back to PHP
        for updating in the relevant tables. Can anyone please give me ideas.
        Appearing and disappearing is one for javascript indeed, so ask that in
        comp.lang.javas cript. I'd say both text inputs are in a container with
        display=none, so the inputs are always in the form.

        For this HTML fragment:
        <input name="updateche cktexts" type="checkbox"
        onclick="someFu nctionToShowInp uts(this.checke d);">
        <div id="hidden_bloc k" style="display: none;">
        <input name="text1" value="foo">
        <input name="text2" value="bar">
        </div>

        The receiving PHP code would be:
        if(isset($_POST['updatechecktex ts'])){
        //do something with $_POST['text1'] & $_POST['text2']
        }

        .... and make sure your page works with javascript OFF.
        --
        Rik Wasmus

        Comment

        • sheldonlg

          #5
          Re: Displaying text boxes from a check box

          chimambo@google mail.com wrote:
          I want to make visible two or more text boxes once a user has ticked
          a checkbox. I know javascript will come in here, but am a newbie.
          However, I want to maintain the variables and move them back to PHP
          for updating in the relevant tables. Can anyone please give me ideas.
          Ask in comp.lang.javas cript. This is a standard javascript operation.
          First, though, look in google with words such as
          javascript toggle visible
          Many solutions are already published.

          Comment

          Working...