Dynamic Variables Problem

Discussion in 'PHP' started by elum.chaitu, Sep 28, 2010.

  1. #1
    I generate Several form fields on my page by looping through the SQL records and appending the counter to the end of the Field name which gives me unique field names for each row.
    However I'm having trouble processing this data in the processing script.

    This is basically the code i wish to use. I'm sure the problem lies in the $i in the $_POST command but I've tried everything I can think of and can't get it to pull the data over.

    for ($i = 0; $i <= $FF; $i++):
    $FFRSN=$_POST['CFFDN_FFFDN_RSN$i'];
    printf($FFRSN);
    endfor;
     
    elum.chaitu, Sep 28, 2010 IP
  2. Media Signal

    Media Signal Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Invalid FOR loop syntax and variable embedding.

    for ($i = 0; $i <= $FF; $i++)
    {
    	$FFRSN = $_POST['CFFDN_FFFDN_RSN' . $i];
    	printf($FFRSN);
    }
    PHP:
    ** Not tested - let us know if you have any trouble with this code ..
     
    Media Signal, Sep 28, 2010 IP