How do you use variables within $_POST? I’ve tried using $_POST[$row[‘Field’]]; I’ve tried assigning this to a variable to see if it works and then echoing the value but nothing is displayed.
How do you use variables within $_POST? I’ve tried using $_POST[$row[‘Field’]]; I’ve tried assigning
Share
$_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:
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.