Saturday 23 April 2011

PHP Header Script With Examples





HEADERS

*Header is a small amount of data packet network protocols to transform the information from one location to another location. You can transform the information with the header function in PHP.

danphp1.php

<?php
echo "welcome";
?>
danphp2.php

<?php
if(isset($_POST['sub']))
{
header("location:page1.php");
}
?>
<form method="post" action="">
<input type="submit" name="sub" value="Go">
</form>

danphp3.php

<?php
if(isset($_POST['sub']))
{
header("location:page1.php");
}
else if(isset($_POST['sub1']))
{
header ("location:page2.php");
}
?>
<form method="post" action="">
<input type="submit" name="sub" value="page1">
<input type="submit" name="sub1" value="page2">
</form>

Execute above files and observe the header function and works.

0 comments:

Post a Comment