Click to See Complete Forum and Search --> : Input field names.


DanUK
07-08-2004, 06:58 AM
Hello,

Just a quick question I'm sure you'll know.

At the moment, all my input fields have name=".." which contain no spaces. This can look very confusing on large forms which we have that get submitted by a PHP mailer.

Instead of for example this input field which is:

<input type="text" name="webURL" maxlength="150" />

Which comes through on the mail as:

WebURL : value

I wanted to change it something more "inviting" for the staff reading the form, so is it possible to use say:

<input type="text" name="The URL this user is reffering to is" maxlength="150" />

Which would come through on the mail as:

The URL this user is reffering to is: value

I looked through the XHTML 1.0 Strict Spec and I cannot see anything saying spaces shouldn't be used in a name, but is it ok?

Thanks in advance.

Regards,

Charles
07-08-2004, 07:13 AM
Just run that puppy through The Validator (http://validator.w3.org/) and you'll know for sure. However, spaces are not permitted in ID names in HTML (http://www.w3.org/TR/html4/types.html#type-id) so you might want to use underscores instead. For extra points have your script replace the undrscores with spaces.

DanUK
07-08-2004, 08:35 AM
Okay that's great, thank you.

I'll just use the underscores, so it'd become i.e:

<input type="text" name="The_URL_this_user_is_reffering_to_is" maxlength="150" />

Thanks again.

Regards,