I'm using a Gravity Forms to create a form but want to do something extra with the data after submission of the form.
I'm using var_dump($_POST); to see what the resulting information that is sent is and I get this:
array(12) { ["input_1"]=> string(8) "John Doe" ["input_2"]=> string(11) "Some School" ["input_3"]=> string(8) "Any City" ["input_4"]=> string(7) "Alabama" ["input_5"]=> string(3) "456" ["is_submit_18"]=> string(1) "1" ["gform_submit"]=> string(2) "18" ["gform_unique_id"]=> string(0) "" ["state_18"]=> string(60) "WyJhOjA6e30iLCI5ZTU3ZGE4Mjk1MjFkYjg3MzRlNGQ5MzZjN2E5OWU1MiJd" ["gform_target_page_number_18"]=> string(1) "0" ["gform_source_page_number_18"]=> string(1) "1" ["gform_field_values"]=> string(0) "" }
I'm not familiar with this, yet (I learn so much from all of your help) how would I use, for example, the result from ["input_5"]?
Thank you in advance.
Do you mean this? echo $_POST['input_5'];
$_POST
is an associate array, meaning that it is a container for multiple values (array) with named keys (associative). A numeric array doesn't have key names, and looks up values by index instead.
Associate Array - use this to store data that intuitively should be named and order does not matter
$myArr = [
'Name' => 'John Doe',
'Address' => '000 Some St.',
'Phone' => '000-0000'
];
$myArr['Address'];
//or
$key = 'Address';
$myArr[$key]; //use a variable as a key
Numeric Array - use this to store the same type of data where order matters
$myArr = [a,b,c,d,e,f,g];
$toDo = [
'Go to the store',
'Buy Eggs',
'Make Breakfast',
'Be Happy'
];
$myArr[0] //"a"
$toDo[1] //"Buy Eggs"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.