checkboxes are not passing respective textboxes values

Discussion in 'PHP' started by goutam.dutta123, Oct 10, 2007.

  1. #1
    Hello Experts,
    Please Help....
    My checkboxes are not passing respective textboxes values to another page

    My checkboxes are moving in a loop
    <input type="checkbox" name="chkID[]" id="chkID" value="<?=$rowSubjectsx['ID']?>">
    My text boxes are also moving in a loop..
    <input type="text" name="quantity[]" id="quan" size="3"/>
    I want to show respective checkboxes sujects and values to another page
    Please help....
     
    goutam.dutta123, Oct 10, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    What exactly is the problem? What is happening?

    You can give the fields that belong together the same key, so later on you know which one belongs to which... if that's your problem?

    
    <input type="text" name="quantity[<?=$rowSubjectsx['ID']?>]" id="quan" size="3"/>
    
    PHP:
    And on the next page..
    
    
    foreach ((array)$_POST['chkID'] AS $id)
    {
        // Value of the "text" field
        $value = $_POST['quantity'][$id];
    }
    
    PHP:

    If that doesn't help, please rephrase your question.
     
    nico_swd, Oct 11, 2007 IP
  3. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Checkboxes that are not checked, will not be passed to php, I believe.
     
    tamen, Oct 11, 2007 IP