Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 5th, 2005, 9:11 PM   #1
mitch_j
Newbie
 
Join Date: Apr 2005
Posts: 1
Rep Power: 0 mitch_j is on a distinguished road
drop down menus, forms and php

Hi there,
I've just managed to get a dependent drop down menu working on a website using the code found here: http://www.zend.com/zend/tut/drop-down.php

The menu is for an Automotive site so it works by make and model of vehicles. My problem is, I can't get an "Any Make" or "Any Model" option to work.
If i set the menu option to have no value, it returns this address: localhost/dfm/auto/carview.php?make=&model=&minprice=&maxprice=[/url]
and no records are loaded.
However, on similar websites I have seen, when the "Any Model" option is selected, the model paremeter does not appear in the address ie: localhost/dfm/auto/carview.php?make=whatever&minprice=&maxprice=[/url]

So my question is, how do I make the form return nothing for that particular menu if that "any..." value is selected?
mitch_j is offline   Reply With Quote
Old Apr 6th, 2005, 3:53 AM   #2
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
localhost/dfm/auto/carview.php?make=&model=&minprice=&maxprice=

looks like you need some values to those parameters you are passing at the minute all you are doing is sending it empty parameters.
Berto is offline   Reply With Quote
Old Apr 6th, 2005, 5:53 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Simple:
[php]if ($_GET['make'])
{
// the variable exists and contains something
}
else if (isset($_GET['make']))
{
// the variable exists, but does not contain anything
}
else
{
// the variable does not exist
}[/php]
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 7th, 2005, 11:59 PM   #4
codetaino
Programmer
 
codetaino's Avatar
 
Join Date: Jan 2005
Location: Bayamon, Puerto Rico
Posts: 71
Rep Power: 4 codetaino is on a distinguished road
You can make your code works as you like in two forms... you can set a value to the Any Model... like lets say "all" so when the variable is send... it has a value of all and you can tap it on the form processing script... the second way is to send the value empty as you are right now and tap the empty value (isset does not test that, it will return true if the variable exists not mattering if it is empty or not) you have to compare it to an empty string or with the empty() function... (if you decide to use the latter... consider that some browsers send the name in the drop box if there is no value set)...

hope that i had been of aid

-codetaino
__________________
"God bless u all" :)

Last edited by codetaino; Apr 8th, 2005 at 12:05 AM.
codetaino is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC