21-02-14, 06:01 AM
هذا الكود الصحيح
<!DOCTYPE html>
<html>
<body>
<h1>this is my form</h1>
<p></p>
<?php
$file="welcome.txt";
$current = file_get_contents($file); // اخذ محتوى النص الحالي
if(!empty($_POST['user']))
{
// هنا فحصنا هل يوجد مدخل ام صفخة عرض
// الان اذا اردت ان تضيف النص للمحتوى السابق
$current=$_POST['user'];
file_put_contents($file, $current);
}
?>
Username: <input type="text" name="user" value=<?php echo "\"$current\"";?> >
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>this is my form</h1>
<p></p>
<?php
$file="welcome.txt";
$current = file_get_contents($file); // اخذ محتوى النص الحالي
if(!empty($_POST['user']))
{
// هنا فحصنا هل يوجد مدخل ام صفخة عرض
// الان اذا اردت ان تضيف النص للمحتوى السابق
$current=$_POST['user'];
file_put_contents($file, $current);
}
?>
Username: <input type="text" name="user" value=<?php echo "\"$current\"";?> >
</body>
</html>