Jump to content

Where do $_POST components get their names?


doubledee

Recommended Posts

In my forms, at the top, I have PHP that fires if the Form was submitted like this...

// *************************************************************
// HANDLE FORM.							 *
// *************************************************************
if ($_SERVER['REQUEST_METHOD']=='POST'){
	// Form was Submitted (Post).

	// Initialize Errors Array.
	$errors = array();

	// Trim all form data.
	$trimmed = array_map('trim', $_POST);

 

 

And then at the bottom of the file I have my HTML Form with controls like this...

<!-- First Name -->
<label for="firstName"><b>*</b>First Name:</label>
<input id="firstName" name="firstName" type="text" maxlength="30"
		value="<?php if(isset($firstName)){echo htmlentities($firstName, ENT_QUOTES);} ?>" /><!-- Sticky Field -->
<?php
	if (!empty($errors['firstName'])){
		echo '<span class="error">' . $errors['firstName'] . '</span>';
	}
?>

 

 

Where is this code getting the name "$firstName"...

<?php if(isset($firstName))

 

 

I guess I am asking what in my Form determines the name of things in the $_POST array??

 

Hope that makes sense?!

 

 

Debbie

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.