By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,746 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,746 IT Pros & Developers. It's quick & easy.

retrieve the values from javascript in php

P: 12
Hi,

Im working with some math pages. Im having page a with user input where the result would be printed with the help of javascript. And now i need to fetch those results and post it another php page using $_get.

How can i get the results of javascript to php page using the query string
Feb 21 '08 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
print a link to the php page with parameters?

somesite.com/?param1=21&param2=456

php
[php]
$_a = $_GET['param1'];
$_b = $_GET['param2'];

echo $_a + $_b;
[/php]
Feb 21 '08 #2

P: 12
hi Mark,

I have to get those querystring values as a result of javascript function execution. How to get it from query string. Thanks in advance

print a link to the php page with parameters?

somesite.com/?param1=21&param2=456

php
[php]
$_a = $_GET['param1'];
$_b = $_GET['param2'];

echo $_a + $_b;
[/php]
Feb 22 '08 #3

hsriat
Expert 100+
P: 1,654
hi Mark,

I have to get those querystring values as a result of javascript function execution. How to get it from query string. Thanks in advance
After you print the page, add this...

Expand|Select|Wrap|Line Numbers
  1. var getString = 'a=' + a + '&b=' + b; //and so on for all the data to be sent to PHP
  2. window.location.replace('afterExecutionPage.php?'+getString);
  3. //or use window.location = ".......";
Feb 22 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.