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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.