Trapping Array in Request

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shalini Bhalla
    New Member
    • Dec 2007
    • 190

    Trapping Array in Request

    hi , actually i have a for in which checkeboxes are created dynamically as follows
    [PHP] $i = 0 ;
    while($row1 = mysql_fetch_arr ay($res))
    {
    echo "<tr>";
    echo "<td width='27%' align='left'>
    <input name='eve[".$i."]' type='checkbox' value='".$row1['event_code']."'></td>";

    echo "<td width='27%' align='left'>
    <input name='eve_nm[".$i."]' type='text' readonly value='".$row1['event_name']."'></td>" ;
    echo "</tr>";
    $i++ ;
    }[/PHP]

    and in when i check randomly these checkboxes i get output as follows :

    Array ( [cont] => 17 [eve_nm] => Array ( [0] => dfgfd [1] => dfgfd [2] => gjhgjhg [3] => etete [4] => abcd [5] => abcd [6] => hgf [7] => hfggf [8] => Birthday [9] => ) [eve] => Array ( [2] => 25 [4] => 27 [7] => 30 )

    can any body tell me how to trrap values of [eve] array in next form ?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Hmm, not too sure about your question but,
    [php]
    foreach($_POST['eve'] AS $_key => $_val)
    {
    echo "$_key = $_val<br />";
    }
    [/php]
    ?
    Last edited by Markus; Apr 12 '08, 10:33 AM. Reason: More info.

    Comment

    • Shalini Bhalla
      New Member
      • Dec 2007
      • 190

      #3
      Can i use array_key() for this ?

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by Shalini Bhalla
        Can i use array_key() for this ?
        In what sense?
        I still don't understand what you want.

        Comment

        Working...