Forms of PHP
Forms of PHP
Forms of PHP
Example: 01 print_r($_POST);
}
<form name="f1" action="f1p.php" method="post">
?>
Name:<input type="text" name="n" /><br />
</pre>
Age: <input type="text" name="a" /><br />
Example: 03 (upload)
<input type="submit" value="SUBMIT" /> <form name="frm1" action="<?
=$_SERVER['PHP_SELF']?>" method="post"
</form> enctype="multipart/form-data">
print_r($_GET); <?
print_r($_FILES);
echo"<h4>POST METHOD</h4>";
$on=$_FILES['f']['name']; //originam name
print_r($_POST);
$tn=$_FILES['f']['tmp_name']; // temporary
echo "Your Name is: ".$_POST['n']."<br />"; name and path
?>
if($_FILES['f']['error']==0 and
Example: 02 $ty=="image/jpeg"){
<pre> }
<? endif;
<?
$headers="From:[email protected]";
$headers .= 'From: [email protected]' . "\r\n" .
mail($to,$sub,$msg,$headers);
'Reply-To: [email protected]' . "\r\n" .
?>
'X-Mailer: PHP/' . phpversion()."\r\n" ;
Example: 05 (mail 2)
$headers .= 'Bcc: [email protected]' . "\r\n";
<?
$headers .= 'Cc: [email protected]' . "\r\n";
$to="[email protected]";
Example: 06
<table width="400" border="0" cellspacing="0" <?
cellpadding="0">
echo "<h4>Client IP Address: ".
<tr bgcolor="#ccc"> $_SERVER['REMOTE_ADDR']."</h4>";
<th scope="col">Salary</th> echo "<h4>Script FielName: ".
$_SERVER['SCRIPT_FILENAME']."</h4>";
<th scope="col">HRA</th>
echo "<h4>Script Name: ".
<th scope="col">TD & BD</th>
$_SERVER['SCRIPT_NAME']."</h4>";
</tr>
echo "<h4>Referer Name: ".
<tr> $_SERVER['HTTP_REFERER']."</h4>";
Infosis.com</p>
echo fread($f,10)."<br>";
rewind($f); ?>
fseek($f,0);
while(!feof($f)){
fclose($f);
?>
Form open
<?
$f=fopen("aa.txt","w");
fclose($f);
?>
Form opend
<?
$f=fopen("aa.txt","a+");
fwrite($f,"Thi si supdated1.\n");
fwrite($f,"Thi si supdated2.\n");
fwrite($f,"Thi si supdated3.\n");
fseek($f,0);
while(!feof($f)){
fclose($f);