Jump to content
Sign in to follow this  
real_illusions

form not sending input values

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Ah crap..how stupid do i look
No worse than me. I didn't notice that either... :)

Share this post


Link to post
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...

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...