Answer the question
In order to leave comments, you need to log in
Shortest Feedback Form in PHP?
Hello habrausers!
Can You Suggest or Show
the Shortest PHP Feedback Form?
Answer the question
In order to leave comments, you need to log in
The simplest solution is to use live-hour services (zopim for example).
I don't know about brevity, but it works.
Sends by mail and writes to a file (it must be created in advance).
$datet=date('d-m-Y',time());
@Header("Content-Type: text/plain; charset=utf-8");
$timet=date('H:i');
$text=htmlspecialchars(str_replace(";",".,",urldecode("{$_POST['text']}")));
$name=strip_tags(str_replace(";",".,",urldecode("{$_POST['name']}")));
$email=strip_tags(str_replace(";",".,",urldecode("{$_POST['email']}")));
$text=str_replace("\\"," ",$text);
$text=str_replace("\r"," ",$text);
$text=str_replace("\n"," ",$text);
$ip = $_SERVER['REMOTE_ADDR'];
mail("[email protected]", "Сообщение с сайта", "Форма $form\n$name\n$email\n$text\n\n$timet\n$datet\nIP: $ip");
$res="<tr><td>$datet</td><td>$timet</td><td>*$ip*</td><td>$name</td><td><b>$email</b></td><td>Текст: $text</td></tr>";
$fp = fopen("feedback.txt", "r");
if ($fp) $text= fgets($fp);
fclose($fp);
$fp=fopen("feedback.txt","w");
fwrite($fp,"$res$text");
fclose($fp);
Probably This Code Is Short! Or is there another code?
<?php
$result=mail("[email protected]", "Письмо с контактов", " Имя : $_POST[name] \n Е-маил: $_POST[email] \n Телефонный номер : $_POST[phone] \n Письмо: $_POST[comments]");
if($result){
echo "<p>Ваше сообщение Отправлено !</p>";}
else{
echo"<p>Сообщение НЕ отправлено !</p>";
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question