Help needed with passing form values (old PHP Version)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dreamerdk
Forum Newbie
Posts: 2
Joined: Fri Sep 27, 2002 10:51 am
Location: Denmark
Contact:

Help needed with passing form values (old PHP Version)

Post 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
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

try SELECTED="SELECTED" instead of ="yes" that might fix it.
User avatar
lanlord
Forum Newbie
Posts: 13
Joined: Wed Sep 18, 2002 10:02 am

I always just use SELECTED

Post by lanlord »

It might not be the correct way to do it, but I always just use SELECTED, and it works.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
Dreamerdk
Forum Newbie
Posts: 2
Joined: Fri Sep 27, 2002 10:51 am
Location: Denmark
Contact:

Post 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
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
User avatar
lanlord
Forum Newbie
Posts: 13
Joined: Wed Sep 18, 2002 10:02 am

Post by lanlord »

have you tried METHOD="post" ?
Post Reply