Now I have page having a form like below (2index.php)
Code: Select all
<html>
<head>
<title>Welcome to PHP world.</title>
</head>
<body>
<?php
$today = date("F j, Y, g:i a");
print($today.'<br>');
print('There are '.date('t').' days in this month.');
?>
<center>
2 index
<form action="2hello.php" method="post">
<p>Enter your Name: <input type="text" name="name" /></p>
<p>Your Extension: <input type="text" name="extension" /></p>
<p><input type="submit" value="Enter" /></p>
</form>
</center>
</body>
</html>Now I have another page which writes to a file and displays all.The code for the Page (2hello.php) is like below
Code: Select all
<html>
<head>
<title>Welcome</title>
</head>
<body>
<?php
print('Hello '.$_POSTї'name'].' .<br>');
$fp = fopen("guests.txt", "r+b");
$theUser = 'Person - '.$_POSTї'name'].". ExtNo- ".$_POSTї'extension']." .<br>";
$guests = fread($fp,filesize("guests.txt"));
$search = stripos($theUser,$guests);
if($search=== false){
print("can not find any match<br>");
print("$search<br>") ;
fputs($fp,$theUser);
} else{
print("Match found.<br>") ;
}
readfile('guests.txt');
fclose($fp);
?>
</body>
</html>Warning: fread() [function.fread]: Length parameter must be greater than 0. in D:\Saumya\PHP\2hello.php on line 10
can not find any match
So how to get rid of all this.
Thank you
Saumya
feyd | USE THE FORMATTING