Hi all,
My first post on the forums, since i am stack at a particular problem.
I have a form, and i pass values with the post method. Now the problem is, that this value must be passed to two different php scripts, and the first script has a function in it that calls the second script. Its an sql query, and cant seem to be able to make it work with a variable in the query. When i place a standard value, it works fine.
I tried to require the first script in the second one and use the value from that one, but cant make it work.
Appreciate any help
Looking forward to an answer
passing a post value to 2 scripts
Moderator: General Moderators
Re: passing a post value to 2 scripts
Can you post us the code for both of your scripts so that we can suggest you a solution.?
Since you are new.. i am just suggesting to please post the code in appropriate tags.
Since you are new.. i am just suggesting to please post the code in appropriate tags.
Re: passing a post value to 2 scripts
I am building a google maps application, and i have a search option for price, that i pass with post method
The script that the post action calls (generatePrice.php) gets the post value with
Now, my generateXML.php script, needs that same value that was posted to generatePrice.php, so i can make an sql query on my db, and get the search results.
Thanks for your time
The script that the post action calls (generatePrice.php) gets the post value with
and at some point, i have the following code$var = @$_POST['q'] ;
Code: Select all
GDownloadUrl("generateXML.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");Now, my generateXML.php script, needs that same value that was posted to generatePrice.php, so i can make an sql query on my db, and get the search results.
Thanks for your time
Re: passing a post value to 2 scripts
you can send the value in session if its in the same server. Else you need to send it as a get variable
generateXML.php?q=$_POST['q'] ;
in the generateXML.php file, access the same as $var = $_GET['q'];
See if this is what you are looking for.
generateXML.php?q=$_POST['q'] ;
in the generateXML.php file, access the same as $var = $_GET['q'];
See if this is what you are looking for.
Re: passing a post value to 2 scripts
Thank you for your answer, i have used
It works like a charm!! You have just made my day!
Thank you so much !
Code: Select all
session_start();
$var = $_GET['q'] ;
session_register('var');Thank you so much !