-1

Possible Duplicate:
PHP: Pass non-form variables between pages?

I have problem with passing data dynamically populated. The code below dynamically display the restaurant hours of operation. Now I want to pass this hours into new page.

while ($start <= $end)
        {
            $startIn = strtotime('+0 minutes',$start);
            $hourIn = ( date('h:ia', $startIn));

            //dispaly restaurant availability
            echo "<td id='td'>"."<a href='$resName.php' style='text-decoration: none;'>" . $hourIn ."</a>". "</td>";
            $start = strtotime('+30 minutes',$startIn);
        }
Community
  • 1
  • 1
Tomasz Ziobro
  • 21
  • 1
  • 6

2 Answers2

1

You should use global variables as $_POST and $_GET:

an Example of how to use GET method:

if you go from one page to another following a hypertextual link in which you put variable names and associated values separated by = symbol

<a href="resName.php?variable_1=$hourIn" >

you can acces value of variables like this and store it in local variables of your arrival page:

$local_var = $_GET['variable_1']
Matteo
  • 7,924
  • 24
  • 84
  • 129
0

pass your data by using GET (or POST) method

like following,

echo "<td id='td'>"."<a href='resName.php?hours=".$hourIn."' style='text-decoration: none;'>" . $hourIn ."</a>". "</td>";

in resName.php, you can get this data like following,

$variable=$_GET['hours'];
Manoj
  • 477
  • 5
  • 8
  • 19