Something wrong with $_POST

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

    Something wrong with $_POST

    HI, everyone.

    I don't seem to be able to access the keys in an associative array.

    I have a script that dynamically generates a form. The form element
    names are generated based on image filenames, so I can't just access
    them the normal way in the form handler script. I tried looping through
    the $_POST array like this:

    foreach ($_POST as $key=>$value)
    {

    echo $key.'=>'.$valu e.'<br>';
    }

    and i get this output:

    0=>Pay
    1=>Pay
    2=>on
    3=>on
    4=>tn__DSC2602. jpg
    5=>tn__DSC2603. jpg

    Thos numbers are where I expected to see the form element names. Can
    anyond advise me on why this is happening?

    Derek

  • Juliette

    #2
    Re: Something wrong with $_POST

    jderek@gmail.co m wrote:
    HI, everyone.
    >
    I don't seem to be able to access the keys in an associative array.
    >
    I have a script that dynamically generates a form. The form element
    names are generated based on image filenames, so I can't just access
    them the normal way in the form handler script. I tried looping through
    the $_POST array like this:
    >
    foreach ($_POST as $key=>$value)
    {
    >
    echo $key.'=>'.$valu e.'<br>';
    }
    >
    and i get this output:
    >
    0=>Pay
    1=>Pay
    2=>on
    3=>on
    4=>tn__DSC2602. jpg
    5=>tn__DSC2603. jpg
    >
    Thos numbers are where I expected to see the form element names. Can
    anyond advise me on why this is happening?
    >
    Derek
    >
    try this and see what you get from the server, should give you a clue:

    print '<pre>';
    print_r( $_POST );
    print '</pre>';

    Comment

    • Andy Hassall

      #3
      Re: Something wrong with $_POST

      On 16 Sep 2006 16:44:20 -0700, jderek@gmail.co m wrote:
      >I don't seem to be able to access the keys in an associative array.
      >
      >I have a script that dynamically generates a form. The form element
      >names are generated based on image filenames, so I can't just access
      >them the normal way in the form handler script. I tried looping through
      >the $_POST array like this:
      >
      >foreach ($_POST as $key=>$value)
      >{
      >
      echo $key.'=>'.$valu e.'<br>';
      >}
      >
      >and i get this output:
      >
      >0=>Pay
      >1=>Pay
      >2=>on
      >3=>on
      >4=>tn__DSC2602 .jpg
      >5=>tn__DSC2603 .jpg
      >
      >Thos numbers are where I expected to see the form element names. Can
      >anyond advise me on why this is happening?
      What does your form look like?

      --
      Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
      http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

      Comment

      Working...