My code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
if (!isset($_REQUEST['start'])) {
?>
<form action="<?php $_SERVER['SCRIPT_NAME']?>" method="post">
<p><label> Login: <input name="login" type="text" size="15" /></label></p>
<p><label>Password: <input type="password" name="parola"></label></p>
<p><label>Emailul dvs:<input type="email" name="email"></label></p>
<p><label>Lasati mai jos mesajul dvoastra: <br /> <textarea name="mesaj" cols="50" rows="6" placeholder="Scrieti aici ceva..."></textarea></label></p>
<p><input type="reset" value="Anuleaza" />
<input type="submit" value="Transmite" name="start" /></p>
</form>
<?php
}
else {
if (isset($_POST['login'])) $log=$_POST['login'];
if (isset($_POST['mesaj'])) $mesaj=$_POST['mesaj'];
if(isset($_POST['parola'])) $pass=$_POST['parola'];
if(isset($_POST['email'])) $mail=$_POST['email'];
$file=fopen('Homework.txt', "a+") or die ("Fisier inaccesibil!");
fwrite($file, $log);
fwrite($file, " ");
fwrite($file, $pass);
fwrite($file, " ");
fwrite($file, $mail);
fwrite($file, " ");
fwrite($file, $mesaj);
fwrite($file, "\n");
fclose($file);
echo 'Datele au fost salvate! Iata ce este in fisier: <br />';
$file=fopen("Homework.txt", "r") or die ("Fisier inaccesibil!");
while (!feof($file)) {
echo fgets($file). "<br /><br /><br />";
}
fclose($file);
}
?>
</body>
</html>
I just want the result looking like that: |Login | Password | Mail | Message | |John | Doe | johndoe@mail.com | Just a little text here. |