Forum Moderators: coopster

Message Too Old, No Replies

sending variables to other pages w/out going to other page

php Post variables using forms database select

         

shudson250

1:02 am on Jul 29, 2007 (gmt 0)

10+ Year Member



So I'm doin a project...

Basicaly I'm getting information from the db with one php page, getting that info with a javascript, and displaying the result on my main page. What I need to do now, is have it so a user can select an option, using a drop-down or something, on the main page, and use that option as part of the query. So...

user selects: Vancouver
posted to php file as city
php file $city = $_POST['city'];
query = 'SELECT * FROM $city';

This file then outputs xml, so I cant go to that page and have a redirect. I need everything to stay on the index page.
Any suggestions/magic?

Habtom

10:20 am on Jul 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can start by submitting the form info to the same page. Use $_SERVER['PHP_SELF']; in the form action.

shudson250

7:37 pm on Jul 29, 2007 (gmt 0)

10+ Year Member



So now that page has the variables, but what I really need is for that page to send those to the xml page, without actually redirecting to the xml.

shudson250

1:39 am on Jul 30, 2007 (gmt 0)

10+ Year Member



I think I've got the solution, but I need to get some help with the javascript (i think I may have forgotten this part). The main page uses javascript to download the information from the xml file.
So instead of a php form, I'll use a javascript form and get the variables that way. To work around the php xml file, I'll create multiples with different names and just use the variables to call the different pages. Good ol' mickey mouse workarounds...