Monday, 16 May 2011

Learn PHP online : PHP Day-15

PHP Header Script 





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.

No comments:

Post a Comment

Visual comparison of the two methods, creating a simple table.

Option 1, using PHP: // PHP $html = '<table>' ;     foreach ( $data as $row ) {     $html .= '<tr>...