javascriptphphtmlphp4

how can i get single value at next page from multiple values in another page using php


there are 3 JavaScript functions and each function contain a single table name in one page and i am calling any one function at single time.. how can i get that table name in another page using php ??

page1.php

session_start();                         
function one()
{
   $_session['one']='table1';
   window.location('page2.php');
}

function two()
{
   $_session['one']='table2';
   window.location('page2.php');
}

page2.php

session_start();
$tablename=$_session['one'];

i get only table2 value at next page when i call function one or function two..how i get table1 value when i call function one and table2 value when i call function two ?


Solution

  • try to something like this.

        page1.php                         
         fuction one()
         {
           session_start();
           $_session['one']='table1';
           window.location('page2.php');
         }
    
         function two()
         {
          session_start();
          $_session['one']='table2';
          window.location('page2.php');
         }
    
         page2.php
         session_start();
         $tablename=$_session['one'];