function getUname(){
echo $_POST['username'] . " and password " . $_POST['pword'] ;
if($_POST['username'] =='' || $_POST['pword']=='')
echo 'You did not enter a username and password'; }
>
if(isset($_POST['username'])&& $_POST['username']!="" && isset($_POST['pword'])&& $_POST['pword']!='' )
getUname();
How to use GET
Click Me <?php
$url = $_SERVER['PHP_SELF'] .'?username=joe&age=33';
$link= "<a href='$url'>Click Me </a>";
if(isset($_GET['username']) && isset($_GET['age']))
{
echo $_GET['username'] . ' is ' .$_GET['age'] ;
}
else
echo $link;
?>
One final note, you should always filter variables that come from the outside. It would be very easy for someone to hack our server based on our current code. To help combat this problem use
strip_tags();so always use
strip_tags($_GET['varable]) around variables that you are taking in from a user. This prevents them from
deleting files on your server etc..