0

No... honestly... I mean this is REALLY dumb!

I have a form with a select that looks like this:

<select name='toasters'>
<option value='1'>Toaster 1</option>
<option value='2'>Toaster 2</option>
<option value='3'>Toaster 3</option>
<option value='4'>Toaster 4</option>
</select>

In my php I read (or try to read) the value with:

$toaster = $_POST['toasters'];

No matter which toaster is selected, $toaster returns '0' as in $toaster = 0; when it absolutely should be returning 1-4.

At first I thought this might be happening because the select was not being changed so it was somehow defaulting to ZERO but on further testing and changing the select to which ever toaster I want $_POST still returns a big fat ZERO.

(and no, this is NOT a multi-select)

All other fields and values are being returned correctly... just not the select! The select is displaying properly on the page, it functions properly, I can view source and it has the values/options it is supposed to have etc.

What in the world am I doing wrong here?

Thanks,

Pete

Edited by ppetree: n/a

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

Is your select inside the <form> tag, and do a var_dump($_POST); to see the values of everything passed from the form

-1

can u provide the code? so that we can trace it.... bec. u fail to show it to us... i suspect that 2 possible reason. 1) maybe you put that code outside your html form. 2.) maybe the form method you use is 'get' and not 'post'. coz. your retrieving your values using the $_POST[] global variable.

0

Is your select inside the <form> tag, and do a var_dump($_POST); to see the values of everything passed from the form

I told you it was really dumb!!!

To avoid further embarassement we'll not mention that the select was two lines above the form tag and we'll appreciate it if no one else mentioned it either! :twisted:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.