Assignment 3 : A1

SET A : A1


<!DOCTYPE html>
<html>
<head>
 <title>A1</title>
 <style type="text/css">
  i{color:blue;}
  d{color:gray;}
  u{color:green;}
 </style>
</head>
<body>
<fieldset><legend>&nbsp <b>Enter appropriate file name form given directory</b> &nbsp</legend>
<form method="POST"><br/>
 <b>Enter 1st File Name :&nbsp</b><input type="text" name="str1"><br/><br/>
 <b>Enter 2nd File Name :&nbsp</b><input type="text" name="str2"><br/><br/>
 <input type="submit" name="submit"><hr/>
</form>
</body>
</html>

<?php
 if(isset($_POST['submit']))
 {
  echo "<span style='font-family:comic sans ms;font-weight:bold;'>";
  $file1=$_POST['str1'];
 $file2=$_POST['str2'];
 $file_1=fopen($file1,"a") or exit("<i><center>=> Unable to open file! <=</center></i>");
 $file_2=fopen($file2,"r") or exit("<i><center>=> Unable to open file! <=</center></i>");
 echo "<d>Appending...</d>";
 
 $data=fread($file_2,4096);
 fwrite($file_1,$data);
 fclose($file_1);
 fclose($file_2);
 
 $file=fopen($file1,"r");
 echo "<br/><d>Reading...</d><br/><br/><fieldset>";
 $data=fread($file,4096);
 echo "<b><u>Data in ".$file1."</u> :</b><br/>".$data."</fieldset>";
 fclose($file);
 echo "</span>";
 }
?>


Comments

Popular posts from this blog

T.Y.BSc Computer Science PHP Assignment

माझ्या आवडीचे पान...