How to save E-mails from Comment

Multi tool use
Multi tool use


How to save E-mails from Comment



i am very new with html/css too with php and my English is very poor.. so , my problem ... , i have this code:


<?php
date_default_timezone_set('Europe/Paris');

$content = "";

if(file_exists("messages.inc.html"))
$content = file_get_contents("messages.inc.html");

if(isset($_POST['post']))
{
$time = date('Y-m-d H:i:s');

$content .= "n<b>From:</b> " . htmlspecialchars($_POST['name']) .
" <b>eMail:</b> " . htmlspecialchars($_POST['email']) .
" <b>at:</b> $time<br><br>" .
htmlspecialchars($_POST['text']) . <"hr">;

file_put_contents("messages.inc.html", $content);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Message schreiben</title>
</head>
<body>
<h1>Messages</h1>
<h2>Insert new Message:</h2>
<form action="" method="post">
<label>E-Mail: <br><input type="text" name="email"><br></label>
<label> Name: <br><input type="text" name="name"><br></label>
<label> Message: <br><textarea cols="45" rows="6" name="text">
</textarea><br></label>
<input type="submit" name="post" value="post">
</form>

<?php
if (strlen($content))
echo $content;
else
echo "<h2>No Messages availabe</h2>";
?>
</body>
</html>



When someone will write his E-mail in the comment, I dont want it to be displayed alongside comment later. Instead, i want to save the email to my **messages.inc.html** file. How can i do it? Can anyone please help me , Thanks !


**messages.inc.html**





I'm sorry, but I have no idea what your question or issue is.
– Magnus Eriksson
Jul 1 at 9:03






thanks for your answer , i have a File , messages.inc.html , when someone write his Comment and name , save this information to this File , but the E-mail not ....
– 3edf1w
Jul 1 at 9:09






You have a field name="text" with the message, but you don't do anything with it. You need to save the value just like the other two variables.
– Progman
Jul 1 at 16:44


name="text"





@ Progman , can you please explain how to do it . I am only two Months with html and only 10 days with PHP... , Thanks!
– 3edf1w
2 days ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

JzMUYq,BY5 yq,xn7 JPW4sl 4OkAPUBJdwQjea3m,Qo6 SsSZZ
yLxhFh 6

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters