use of get variable in php

GetVariables.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>use of get variable in php</title>
</head>

<body>
 <h2 style="color:#fff; background:#aaa; text-align:left;">use of get or url variable in php</h2>
 <a href="<?=$_SERVER['SCRIPT_NAME'];?>?getIt=this is iqbal">Click me</a>
 <pre>
  <?php
   /*
   |---------------------------------------------------------------------------------------------------------
   | <?=$_SERVER['SCRIPT_NAME'];?> it is a server variable along with assignment for print
   | by using ? mark we can pass a variable to a page
   | getIt is a url or get variable and we are passing it
   |---------------------------------------------------------------------------------------------------------
   */
   print $_GET['getIt'];
  ?>
 </pre>
 
</body>
</html>




use of get or url variable in php - output

No comments:

Post a Comment

leave your comments here..