Reply to Re: NEWBIE: validating drop down values

Your name:

Reply:


Posted by Rik Wasmus on 09/01/07 19:36

On Sat, 01 Sep 2007 21:27:47 +0200, ELINTPimp <smsiebe@gmail.com> wrote:=


> On Sep 1, 3:16 pm, The Natural Philosopher <a...@b.c> wrote:
>> ELINTPimp wrote:
>> > On Sep 1, 2:25 pm, skim1114 <skim1...@gmail.com> wrote:
>> >> I am embarrassed to ask this, but I've worked on this for hours an=
d I
>> >> can't seem to find what the error is. I am trying to teach myself =
php
>> >> and I am in the very early stages of understanding it. I have a bo=
ok
>> >> that I am walking through. I created a form to validate...all piec=
es
>> >> I've coded work, except the piece for the age drop down. There are=
3
>> >> options, 0-20, 30-60, and 60+. What in the code is wrong here? I
>> >> understand this might not be the most efficient way to code this, =
but
>> >> like I said, I'm just starting.
>>
>> >> I'm sure anyone with php knowledge could help me out with this in =
a
>> >> second.
>>
>> >> Thanks in advance. Code below:
>>
>> >> ---------
>>
>> >> if (isset($_REQUEST['age'])) {
>> >> $ =3D $_REQUEST['age'];
>>
>> >> if ($age =3D=3D '0-29') {
>> >> echo '<p>Your age selection was between 0-29</p>';=

>> >> }elseif ($age =3D=3D '30-60') {
>> >> echo '<p>You age selection was between 30-60</p>';=

>> >> }elseif ($age =3D=3D '60+') {
>> >> echo '<p>You age selection was between =

>> 60+</p>';}else{
>>
>> >> $age =3D NULL;
>> >> echo '<p><font color=3D"red">You forgot to select you =

>> age!</font></p>';
>>
>> >> }
>>
>> >> --------
>> >> $ =3D $_REQUEST['age'];
>> > needs to be:
>> > $age =3D $_REQUEST['age'];
>>
>> what does [ '30-60' ]evaluate to as well?..
>>
>> a string "30-60"?
>> Or a numeric -30 ?
>>
>> I suppose its a questiopn of what is in $age.... :-)
>>
>> It's not clear..
>
> Yeah, I was assuming it was a string.

Perfectly reasonable as all GET, POST & COOKIE values are initially =

considered strings by PHP.
-- =

Rik Wasmus

My new ISP's newsserver sucks. Anyone recommend a good one? Paying for =

quality is certainly an option.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация