Jump to content

form not sending input values


real_illusions
 Share

Recommended Posts

Hi all,I have a form which doesn't like sending the values of the input fields.I cant really show you the page with the HTML code as its a private project I'm working on.However, the PHP script I've used several times before, and although I've modified it to suit the form values this time around...nothing else has changed.Here is an example of one input value:<label for="firstname">First Name:<input type="text" id="firstname" value="" /></label>The form is <form method="post" action="test.php">and in test.php is simply var_dump( $_POST ); to find out whats been sent.Basically, the submit input value is the only one being sent. Even if I set an input with a value hard coded (such as the example above), it still doesn't send.Are there any possible reasons for this?

Edited by real_illusions
Link to comment
Share on other sites

Is it possible that being wrapped in the label is somehow confusing the browser into thinking the input should not be sent? Try keeping the input out of the label and see what happens.

Link to comment
Share on other sites

It was all valid HTML when I did the input inside a label...although if the name attribute is required, but still valid HTML? Hmm..will have to see about that. Are the W3 saying that the input is valid without a name attribute, but yet its required for processing the form...interesting...

Link to comment
Share on other sites

There is no requirement for a form to be sent at all, and no requirement for all form input data to be sent. You might, for example, want to use several form elements to calculate a single value that is sent. These are just a few reasons why you might not want to bother with a name attribute.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...