Page 1 of 1

Help needed with passing form values (old PHP Version)

Posted: Fri Sep 27, 2002 10:51 am
by Dreamerdk
Hi guys

I'm pretty new to PHP and just ran into a problem, which is probably the easiest question to answer for you guys :)

I am working with forms and are trying to set up a form to pass some values into another php file. It works fine with textareas and inputboxes, but as soon as I try with radio or select it doesn't work.

No matter what I select it always pass on the first value listed on the original page.

I am running PHP 4.0.6 and the html part look like this:

<form name="frm" method="get" action="insertsetdaymsg.php">

Code: Select all

<SELECT NAME='txtoften'>
<OPTION VALUE='every'>Every</OPTION>
<OPTION VALUE='everyother' SELECTED='yes'>Every Other</OPTION>
<OPTION VALUE='everythird'>Every Third</OPTION>
<OPTION VALUE='everyfourth'>Every Fourth</OPTION>
</SELECT>
Even though I tried making "Every Other" the default, it still pass "Every"

Can anyone guide me on? Thank you :)

Jesper

Posted: Fri Sep 27, 2002 10:58 am
by nielsene
try SELECTED="SELECTED" instead of ="yes" that might fix it.

I always just use SELECTED

Posted: Fri Sep 27, 2002 11:05 am
by lanlord
It might not be the correct way to do it, but I always just use SELECTED, and it works.

Posted: Fri Sep 27, 2002 11:09 am
by nielsene
In HTML 4.01 the "right" way is just SELECTED (a minimized attribute).

In XHTML 1.0 the only way is selected="selected".

The XHTML way should work on legacy browsers with one or two very esoteric exceptions that require one or both occurences to be ALLCAPS.

I would not expected SELECTED="yes" to work reliably in browsers.

Posted: Fri Sep 27, 2002 11:27 am
by Dreamerdk
Hi

Thank you for the reply.

That didn't solve the problem though. The output on the HTML page (where I have the form) is fine. But nomatter which I select it pass the same value (Every Other).

Thanks :)

Jesper

Posted: Fri Sep 27, 2002 11:33 am
by nielsene
What browser are you using? It sounds like this is a proplem with the browser, not with your code, but I'm not positive.

Posted: Fri Sep 27, 2002 11:54 am
by lanlord
have you tried METHOD="post" ?