Connecting Tech Pros Worldwide Help | Site Map

Need to get values form form without going to a new script

ctp ctp is offline
Newbie
 
Join Date: Oct 2006
Posts: 1
#1: Oct 19 '06
I'm trying to build an interactive form that dynamically pulls prices from a mySQL table based on a users selection from a number of text & dropdown menus. The idea is that the user does not have to submit the form (and continue to the purchase process) until the user has tried a number of variables and recieved a number of possible prices.

So the way I see it is that the user changes a dropdown, which triggers some PHP code to go fetch the new price for the new combination, and then a piece of PHP code echos that out into the form (which hasn't gone anywhere).

There are over a 100 possible prices based on different combinations, putting this into an array is not the way to go.

Another complication: the page is one server and the mySQL DB is on another server, so $_SERVER['PHP_SELF'] doesn't fly. And the I seem to need to have a an include containing the PHP on the server with the mySQL DB.

I'm not sure if I've just forgotton something elemental or if this is really as difficult as it seems.

Any comments are appriciated - thanks.
Newbie
 
Join Date: Oct 2006
Location: Beside my computer :)
Posts: 13
#2: Oct 19 '06

re: Need to get values form form without going to a new script


Quote:

Originally Posted by ctp

I'm trying to build an interactive form that dynamically pulls prices from a mySQL table based on a users selection from a number of text & dropdown menus. The idea is that the user does not have to submit the form (and continue to the purchase process) until the user has tried a number of variables and recieved a number of possible prices.

So the way I see it is that the user changes a dropdown, which triggers some PHP code to go fetch the new price for the new combination, and then a piece of PHP code echos that out into the form (which hasn't gone anywhere).

There are over a 100 possible prices based on different combinations, putting this into an array is not the way to go.

form that dynamically pulls prices.....out into the form (which hasn't gone anywhere)
I suggest you read what is Ajax technology.

Quote:

Originally Posted by ctp

Another complication: the page is one server and the mySQL DB is on another server, so $_SERVER['PHP_SELF'] doesn't fly. And the I seem to need to have a an include containing the PHP on the server with the mySQL DB.

It's possible and simple.
Reply