[Solved] 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" />
</form>

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

$_POST['first_name']

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

$_POST[$row['Field']];

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:

die(print_r($row,true));

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

die(print_r($_POST,true));

To see if your $_POST variables are set correctly.

1

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