Friday, 15 May 2015

post - PHP: using $_POST within a loop -


On a page I have a dynamically created form in which it has the element (note that for clarity I Left some stuff, examples: table and form element):

  $ getallusers = "select * Ft_users`"; $ Usersstmt = $ modx- & gt; Query ($ getallusers); While ($ line = $ userstat-> fetch (PDF :: FETCH_ASSOC)) {resonant "  ";}   

On the Form Processing page, I am trying to retrieve values:

  $ getallusers =" SELECT * $ Usersstmt = $ modx- & gt; Query ($ getallusers); while ($ line = $ userstat-> fetch (PDO :: FETCH_ASSOC)) {$ userpoints = trim ($ _ POST [ "User_ids"] [$ row [[user id]]];}   

If I do print_r ($ _ POST); I have been sent to the form The array of data is available, so I get the forms that work properly. Part of the variable is converting data into:

  $ userpoints = trim ($ _ POST ["user_ids"] [$ row [[user id]]]);  < / Pre> 

Does anyone know the better way to do this?

In the first code block Change: -

  While ($ rowuser = $ usersstmt-> Fetch (PDO: FETCH_ASSOC))   

to < Pre> while ($ line = $ usersstmt-> Get (PDO :: FETCH_ASSOC))

No comments:

Post a Comment