Results 1 to 4 of 4

Thread: [RESOLVED] PHP - $_POST and looping

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Resolved [RESOLVED] PHP - $_POST and looping

    Hi

    Having a play with PHP and MySql.

    Got what is probably an easy question : $_POST is an array, so how come I cannot loop it with echo $_POST[<num>]
    Where <num> is a number 0 - 7
    I used count on $_POST and it is returning 7... And I can get to the values posted from the from with the name...
    Just can't see why putting a number in the field doesn't work...

    Being thick prolly

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: PHP - $_POST and looping

    If the count is 7, wouldn't it be 0-6?

    That aside, are you getting an error? or just not getting the data?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: PHP - $_POST and looping

    also, keep in mind $_POST and $_GET are special animals, and while they sometimes act like arrays, I'm not sure they are. plus the fields could in theory come in any order so there is no guarnatee that $_POST[0] represents the same field each time. Annnnd... you should know what's coming over in your form fields too, so referring to them by name shouldn't be an issue.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: PHP - $_POST and looping

    Thanks for the info, guess it is a different beast to the normal array.
    0-6 yup, I should be more careful on my post.

    Mainly due to me not getting anything in POST when I was expecting it. Took a while to realise that I needed 'name' in the form controls to get the POST to work. But wanted to loop it to see all that it returned.

    Not a problem. Still messing around an at procedural stage... The OO/PDO looks a bit confusing and some examples I tried, didn't work. So I thought, get it going in procedural and if people want me to develop more, go on a course or something.

    Thanks again

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width