[thelist] dilemmas with php_self
Burhan Khalid
thelist at meidomus.com
Mon Dec 8 04:17:45 CST 2003
Direcway wrote:
> A novice question here:
>
> I have a page with 2 drop down list boxes. One for states and one for
> cities.
>
> Selections made in the state list box accesses the database and populates
> the second drop down list box with cities.
>
> I'm using php_self as the form action to do this and everything works just
> fine ...
> accept, I am unable to call the next page in the series after the
> user makes a selection in the second drop
> down list.
>
> It seems that once I've used the ACTION=$HTTP_SERVER_VARS['PHP_SELF'], I'm
> stuck with it and unable to access the next page using the action attribute
> for the second form control. I've tried a number of different modifications
> like using conditional if(s) to select for different form action attributes
> after the first selection is made without success. I guess I just don't
> understand what's going on here. What do I have to do to access the next
> page and successfully pass my variables for city and state?
A few ways you can approach this.
The javascript way :
When the user selects from the second drop down, change the form's
action attribute to wherever you want it to send, then append the values
as a get request (action ="<?php echo $_SERVER['PHP_SELF'];
?>?state=TX&city=Austin"). You can access the selected value of the
dropdown using javascript and dom.
The PHP way :
Create a session [ http://www.php.net/session ] and then load the
variables into that session. If the both the variables have been loaded,
then you can use header [ http://www.php.net/header ] to redirect to
your next page.
( if you can post some code that you've been working with, that would be
great )
Warmly,
--
Burhan Khalid
thelist[at]meidomus[dot]com
http://www.meidomus.com
-----------------------
"Documentation is like sex: when it is good,
it is very, very good; and when it is bad,
it is better than nothing."
More information about the thelist
mailing list