if checkbox checked then add text to textbox

Discussion in 'PHP' started by ycpc55, May 17, 2012.

  1. #1
    hi
    is there anyway to have a check box add text to a text box when the check box is checked without clicking a submit button? this is what i got and i am almost sure im no where need the right track.

    <?php
    if($_POST['checkbox'] == '1')
    {
    add text box code here
    }
    else
    {
    echo "please select a check box";
    }
    ?>
    <input type="checkbox" value="1" name="checkbox">
    PHP:

     
    ycpc55, May 17, 2012 IP
  2. HostPlanz

    HostPlanz Well-Known Member

    Messages:
    449
    Likes Received:
    34
    Best Answers:
    4
    Trophy Points:
    130
    #2
    .......without clicking the submit button? Seems like you'll be needing to use JavaScript there boy. It's impossible to do that with PHP alone, else you'd need to click the submit button.
     
    HostPlanz, May 17, 2012 IP
  3. ycpc55

    ycpc55 Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    k thanks i will read up on that
     
    ycpc55, May 17, 2012 IP
  4. UpscalePageRanking

    UpscalePageRanking Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There are two possibilites if this code is after the submitting form it will work with value tag of the input type =text otherwise without submitting form you should use javascript
     
    UpscalePageRanking, May 18, 2012 IP