All pastes #203355 Raw Edit

Evil's code

public text v1 · immutable
#203355 ·published 2006-10-15 02:39 UTC
rendered paste body
The HTML form that populates $_POST:

<form method="POST" action="/demos/coderauction/dbtest.php"><br>
<input name=User['Username'] type="text" maxlength=20 value=Test User>
<input type="hidden" name=User['UserID'] value=1><br>
<input type="submit" name="update" value="update"></form>

print_r($_POST) looks like:

Array
(
    [User] => Array
        (
            [\'Username\'] => Test
            [\'UserID\'] => 1
        )

    [update] => update
)

print_r($User) looks like:

Array
(
    [\'Username\'] => Test
    [\'UserID\'] => 1
)

From inside a function: called with $obj->myfunc($User)
function myfunc($user)
		foreach($user as $key=>$value) {
			print "$key=>$value<br>";
		}
}

produces:

\'Username\'=>Test
\'UserID\'=>1