retrieve the values from javascript in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gemguy
    New Member
    • Apr 2007
    • 12

    retrieve the values from javascript in php

    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
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    print a link to the php page with parameters?

    somesite.com/?param1=21&para m2=456

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

    echo $_a + $_b;
    [/php]

    Comment

    • gemguy
      New Member
      • Apr 2007
      • 12

      #3
      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

      Originally posted by markusn00b
      print a link to the php page with parameters?

      somesite.com/?param1=21&para m2=456

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

      echo $_a + $_b;
      [/php]

      Comment

      • hsriat
        Recognized Expert Top Contributor
        • Jan 2008
        • 1653

        #4
        Originally posted by gemguy
        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...

        [CODE=javascript]
        var getString = 'a=' + a + '&b=' + b; //and so on for all the data to be sent to PHP
        window.location .replace('after ExecutionPage.p hp?'+getString) ;
        //or use window.location = ".......";[/CODE]

        Comment

        Working...