<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>lab11</title>
</head>
<body>
<form action="file.php" method="post">
<label>Filename:</label>
<input name="filename"/><br/>
<label>Contents:</label>
<input name="content"/><br/>
<input type="submit" name="submit" />
</form>
<?php
if(isset($_POST["submit"]))
{
$fname=$_POST["filename"];
$content=$_POST["content"];
$fh=fopen($fname,'w');
fwrite($fh,$content);
}
?>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>lab11</title>
</head>
<body>
<form action="file.php" method="post">
<label>Filename:</label>
<input name="filename"/><br/>
<label>Contents:</label>
<input name="content"/><br/>
<input type="submit" name="submit" />
</form>
<?php
if(isset($_POST["submit"]))
{
$fname=$_POST["filename"];
$content=$_POST["content"];
$fh=fopen($fname,'w');
fwrite($fh,$content);
}
?>
</body>
</html>
<?php$file = 'C:/Check.txt';$fh = fopen($file,'w') or die('Could not open the file');fwrite($fh, 'This is some Addition' ) or die('Could not Write to File');fclose($fh);?>
<?php
$file = 'C:/Check.txt';
$data = file($file) or die('Could not
read file');
echo $data[2];
foreach($data as $line)
{
echo $line;
//echo $data[1];
}
?>
<?php
$file = 'C:/Check.txt';
$fh = fopen($file,'r') or die ('Could not
open file');
$data =
fread($fh, filesize($file)) or die ('could not read file');
fclose($fh);
echo $data;
?>
No comments:
Post a Comment