Form and the info

Hi,

I am curious what we can add in the value=“” when using a html form.

Can I include all kind of information in the value,or is only one word allowed? I’m confused because the 'select name=“”'has to be one term.

For example:


<select name="tourtype">
<option value="">-- select option --</option>
<option value="Coach Tour">&#1040;&#1074;&#1090;&#1086;&#1073;&#1091;&#1089;&#1085;&#1099;&#1077; &#1090;&#1091;&#1088;&#1099;</option>
<option value="coachtour">&#1055;&#1083;&#1103;&#1078;&#1085;&#1099;&#1081; &#1086;&#1090;&#1076;&#1099;&#1093;</option>
</select>

Thanks for the answers.
Mathilde

deathshadow60: If you want I can pm the script and give the information about it.

Still seems that sending is the problem. Will see how to change to post.

Thanks for the reply

Again 500 error and I get lost now. Yes PHP issue now. Is it possible to move this part to the PHP forum?
Thanks.

You can have as many words as you like in an option value. My suggestion would be to use an underscore ‘_’ rather than blank spaces just to eliminate any possibility of a stuff up in the way the server side script receives the data.

Regarding having the option value the same or different to the text label for that option, imho it makes absolutely no difference. Most of the time my option values and corresponding text labels will be different…eg…the option text labels could be the actual category names in a product catalogue, but the corresponding option values will be an integer representing the category’s database primary key value.

When I am using Eng. all seems working well. At the moment I am using the cyrillic names, the sending blocks with an original 500 error message.

<tr>
<td align=“left” valign=“top”>
тип номера </td>
<td align=“left” valign=“top”>
<select name=“roomtype”>
<option value=“”>– выбрать –</option>
<option value=“стфндартный”>стфндартный</option>
<option value=“люкс”>люкс</option>
<option value=“семейный”>семейный</option>
<option value=“сьют”>сьют</option>
<option value=“вилла”>вилла</option>
</select>  (required)
</td>
</tr>
<tr>
<td align=“left” valign=“top”>
питание </td>
<td align=“left” valign=“top”>
<select name=“mealplan”>
<option value=“”>– выбрать –</option>
<option value=“BB”>BB, завтрак</option>
<option value=“HB”>HB, Полупансион (Завтрак+ужин)</option>

<option value=“FB”>FB, FПолный пансион (завтрак+обед+ужин)</option>
<option value=“AI”>AI, “Все включено”</option>
<option value=“RO”>RO, только тариф</option>
</select>(required)
</td>
</tr>

As part of the script there is a .mes file and I am using there

Обращение : {title}
Фамилия : {surname}
Адрес : {address}
Индекс : {zipcode}

It is not changing when I use the underscore to connect info in value:

<option value=“Автобусные_туры”>Автобусные туры</option>

<option value=“Пляжныйотдых">Пляжный отдых</option>
<option value="Городские
туры”>Городские туры</option>

The error log:

Useless use of a variable in void context at form.cgi line 83.
Useless use of a variable in void context at form.cgi line 85.
Name “main::IMAGE_PATH” used only once: possible typo at form.cgi line 18.
Name “main::REQ_value” used only once: possible typo at form.cgi line 322.
Name “main::required_stealth” used only once: possible typo at form.cgi line 260.
Name “main::list_value” used only once: possible typo at form.cgi line 478.
Name “main::IMAGE_AUTH” used only once: possible typo at form.cgi line 151.
Name “main::IMAGE_SPLIT” used only once: possible typo at form.cgi line 151.
Use of uninitialized value in string ne at form.cgi line 51.
Odd number of elements in hash assignment at form.cgi line 82.
Odd number of elements in hash assignment at form.cgi line 84.
Use of uninitialized value in concatenation (.) or string at form.cgi line 414.
Use of uninitialized value in concatenation (.) or string at form.cgi line 414.
Use of uninitialized value in concatenation (.) or string at form.cgi line 414.
Argument “” isn’t numeric in numeric ne (!=) at form.cgi line 414.
Argument "
" isn’t numeric in numeric ne (!=) at form.cgi line 414.
Use of uninitialized value in string ne at form.cgi line 154.
Use of uninitialized value in string eq at form.cgi line 221.
Use of uninitialized value in string eq at form.cgi line 221.

Small piece of script:

#############################################################################################

N O N E E D T O E D I T V A R I A B L E S B E L O W

#############################################################################################

my(@gets) = split(/&/, $ENV{QUERY_STRING});
my($get, $name, $value);
foreach $get (@gets) {
($name,$value) = split(/=/, $get);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(“C”, hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(“C”, hex($1))/eg;
$value =~ s/<!–(.|
)*–>//g;
$formdata{“$name”} = $value;

push (@formname,$name);
push (@formvalue,$value);

%formname=@formname;
%formname;
%formvalue=@formvalue;
%formvalue;

Again problem starts when using cyrillic.

Thanks for the help :slight_smile:

Mathilde

Value can contain anything you like so long as you ‘escape’ it to fit in HTML and the appropriate quotes. See how it is also used on INPUT – you can type multiple words into input[text] so naturally you have to be able to assign that as a value.

Though in your example I wouldn’t have values on them! The problem I have with VALUE on OPTION is that it will default to whatever the contents of the OPTION tag is – so saying it twice is just a waste of code; while if you are saying something DIFFERENT from the content, you probably have the wrong content.

It’s like the dipshits who put TITLE on Anchor tags that’s identical to the text inside the anchor. Redundant and just plain waste of code. (yes turdpress skinners, I’m looking at you!)

It appears from your script you are trying to pass it as GET, which means in the URL. Valid URL characters are ONLY ASCII-7 (US-ASCII, characters 32-127), anything above that tends to break… UTF-8 has no chance since URL’s only allow 8 bit escaped characters…
http://www.ietf.org/rfc/rfc1738.txt

To send UTF you need to switch to POST.

Though also likely not helping is the use of tables for nothing and the lack of LABELs… and that has to be the most convoluted form handling code I’ve ever seen… to the point I can’t even figure out what that code snippet is even supposed to do. That we have no idea what the MY or PUSH functions accomplish, much less the values being fed in (I assume $ENV is a dump of getenv?)… What language is that? I’m having doubts that’s even PHP!

Whatever it is this is supposed to be doing, you’ve made it WAY more complicated than necessary.

I don’t agree with that at all. There are plenty of times when I want a different machine readable value to what I want a person to see. I would rarely want the full ‘friendly’ text value submitted with the form.

I never seen any jquery (JavaScript doesn’t use “#” as comments) or php that looks like that…Has to be something else.
I think it is Perl judging from the “.cgi” extension.

Just occurred to me – that’s jquery <snip />, isn’t it? That’s not your php at all, that’s the javascript. (which is … why?)

I’d be interested in seeing that. A lot of that code just looks like gibberish to me…

For example:

$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(“C”, hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(“C”, hex($1))/eg;
$value =~ s/<!–(.|
)*–>//g;

Bitwise nots of unescaped regex mixed with functions?!? That doesn’t make any sense whatsoever… I’d be shocked if php didn’t throw an error on those as last I knew none of that is valid code. Scary part is this ALMOST looks like you are trying to brute force something simple like htmlspecialchars or… something.

Now if that was PERL, it might work (or at least look like it might do something) – but PHP just doesn’t work that way.

What is that even supposed to be doing? I’ve been programming over 30 years with five to six years of PHP and I’ve never seen anything even remotely resembling that.

Even if you can call regex that way (which last I knew you couldn’t) the character restrictions imposed by [a-fA-F0-9][a-fA-F0-9] omits your cyrillic characters! (since regex selected sets don’t usually work with anything but ASCII7, hence why w or W or similar should be used)

Working with something other than PHP then? One of the reasons I LIKE PHP is I can use full text as a key.

Though again we may have a difference of opinion on what machine readable means – it’s like the XML folks calling their format ‘machine readable’ which as someone who started out hand coding machine language I call total bull on.

You can include a value of “two words”, but that is a single string made up of 8 letters and a space, it isn’t like CSS where you have multiple space-separated tokens that act independently. And as Kalon says, avoiding having a space in there reduces the chance of something going wrong.

I guess it’s some sort of CGI script, it certainly doesn’t look like PHP.

My .mes file : Encode in UTF-8 Without BOM
So are all files which not came with script (and using cyrillic)

After both replies I had a look at bizmail.cgi and form.cgi. Now saved in UTF-8 without BOM as well (sometimes it opens in encoding in ANII

Seems now another issue: ERROR NO PAGE SPECIFIED
How I love scripts.

Cannot tell if the utf-8 thing is working now. Continue the search.

Still not working

It is probably to do with your regular expressions or character encoding within the script itself.

what encoding you’re using? php, like UAs, process/render based on encoding. they need to know how to “digest” the byte stream coming their way.

it’s looking like a php forum thread now :wink:

I agree, do a search for US state drop down, most of them will code it like

<option value="AL">Alabama</option>

deathshadow60: Thank you for your reply and explanation.

Now reading my posting, I can imagine you think I will use twice the same ‘value content’ (only written in different ways).

It is not what I meant.

my point was if it is possible to write multiple words in the value element, or that I just can include one word only. To show an example, I used twice the same with different values.

I understand that my first option is possible (multiple words) and that the value is not limited to just one word.

Thanks for your explanation.

Mathilde