Total Pageviews

Wednesday, February 8, 2012

Sending Variables in URL


"page_a.php" or "page_a.html"

 // Send the variables name="ishara" and age=27 to the page_b.php
 <a href="page_b.php?name=ishara&age=27">Send variables</a> 

"page_b.php"

 <?php
  // Retrieve the URL variables (using PHP).
  $name = $_GET['name'];
  $age = $_GET['age'];
                // Display Values
  echo "Name: ".$name."  Age: ".$age;
 ?>


Output

Name: ishara Age: 27
 

No comments:

Post a Comment