Forum Moderators: open

Message Too Old, No Replies

Role of "class=whatever" in an HTML form?

Submitted values not received by PHP

         

mlkarie

4:27 am on Dec 7, 2003 (gmt 0)

10+ Year Member



I've received HTML files from a client for a PHP task. One file has a form with three drop down boxes (<option> stuff).

Some of the code for one of these drop down boxes:

<select name="category" class="buttonssmall">
<option>books</option>
<option>toys</option>

etc.
</select>

The form action calls my PHP file. However, the value of category is not passed on to the PHP file.

If I write a simple program of my own, using options, the whole thing works. The difference between my code and the clients HTML code is that mine does not have a "class" specified for the <select> value. Is there a special syntax that I must use for PHP to read what was selected for category?

What is the function of this "class" specification anyway?

(I've been working in Flash-to-PHP-to-Flash mostly, and am not that clued up on HTML forms.

Thanks
mlkarie

korkus2000

4:29 am on Dec 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The class should not interfere with the form passing information. It defines which css style to use or class.

tedster

4:30 am on Dec 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's a CSS file, most likely declared in an external .css file called from the <head> section of the page (or perhaps declared directly in the <head>).

It only defines how the select element is rendered by the browser for this page and should have no effect on any processing that is done after the submit.

<added>
korkus2000, you're just a bit quicker than me tonight!
Must be the two feet of snow I just finished shovelling.
</added>

mlkarie

4:36 am on Dec 7, 2003 (gmt 0)

10+ Year Member



Thanks a lot, so now I can ignore that.

Will have to look for the problem elsewhere. First have to recreate a MySQL database that become corrupted, then will attend to this again.

IeuanJ

4:42 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



Just as an aside (and hopefully to be helpful) I notices that none of the <option> tags had a value assigned to them. without a value the form element will just contain a null when you process it.

The correct format is as follows.

<select name="category" class="buttonssmall">
<option value = "bookval">books</option>
<option value = "toyval">toys</option>

etc.
</select>

Hope this helps.