Mick
Mick

Reputation: 2898

POST a custom Tag?

I have the following input in a form

  <input name="email" type="text" id="email"size="50" english="Email address"  />

I have a custom tag called english, My question is can I send this as post data and can I recover it on my new page ?

Any help would be much appreciated , Thanks

Upvotes: 0

Views: 65

Answers (3)

Tom
Tom

Reputation: 913

The short answer is: no. The post data received from the HTML in your question will be an array with email as the key, and whatever the user typed as the value.

The solution depends on the problem you're trying to solve. Consider using a hidden input tag instead. For example:

<input name="language" type="hidden" value="English" />

Alternatively, a neater solution would be to store the language in the session (assuming that does what you need). You should never rely on the front end of a website "telling" the back end stuff like this, at least to a certain degree. The back end should just "know".

Upvotes: 0

Amir Bilal
Amir Bilal

Reputation: 457

The best method I can think of right now is to have hidden field with the label as value. Like

<input name="email_label" type="hidden" id="email_label" value="Email address"  />

Upvotes: 0

hsz
hsz

Reputation: 152304

If you use JavaScript to submit your form, you can read you custom tags' values ad append them to the form data to send. Otherwise, clean HTML form just submits only input tags value.

Upvotes: 1

Related Questions