(*FYI: I am processing a form using cURL.) Instead of having to manually enter each incremental line of code in this array, there must be a way to loop this. $field1 = 'Contact0FirstName'; $field2 = 'Contact0LastName'; $field3 = 'Contact0Email'; $post_data = array( $field1=>urlencode($_POST[$field1]), $field2=>urlencode($_POST[$field2]), $field3=>urlencode($_POST[$field3]) ); PHP: This doesn't work: for($i=0; $i<=2; $i++) { $post_data = array( $field[$i]=>urlencode($_POST[$field[$i]]), ); } PHP: ... AND ALSO ... Is there a way to receive ALL $_POST input values without specifically entering each input NAME from the form? Thanks.
I'm not sure about your first part but when you say: "Is there a way to receive ALL $_POST input values without specifically entering each input NAME from the form?" Not sure exactly the result you are looking for, but you can loop through the POST in a foreach as it's an associate array. For example use this loop: foreach ($_POST as $key => $value){ echo "Key: $key Value: $value"; } PHP: