How do you use variables within $_POST? [closed]

$_POST is an associative array that is set by forms using the “method=post” attribute. You can access it like the following:

Lets say you have the form:

<form action="" method="post">
Name: <input type="text" name="first_name" />
<input type="submit" value="Submit" />

You would access the “first_name” input box using the following variable:


If “row” is an array that you have made (for example: $row = array(‘Field’ => ‘first_name’);):


Notice that since “row” is a PHP array, you must have the “$” before it.

If using $row doesn’t give you the right result, you can do:


To see what “$row” is currently set to. Check to make sure that $row is correct, then do a:


To see if your $_POST variables are set correctly.

Leave a Comment