N
N
nurtay19942014-05-02 13:38:17
PHP
nurtay1994, 2014-05-02 13:38:17

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

4 answer(s)
R
RomanAkaMagician, 2014-05-02
@RomanAkaMagician

one single "get an answer" button.

S
Sergey, 2014-05-02
Protko @Fesor

The simplest solution is to use live-hour services (zopim for example).

P
Pontific, 2014-05-02
@Pontific

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);

N
nurtay1994, 2014-05-02
@nurtay1994

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 question

Ask a Question

731 491 924 answers to any question