PHP-Formular Ausgabe
Ozzu,
Ich habe Probleme mit der Übertragung meiner Website-Besucher Informationen aus dem HTML-Formular, um meine PHP-Datei an meine E-Mail-Adresse bezeichnet.
Alles, was ich sehe, wenn ich am geöffneten E-Mail lautet:
-------------------------------------------------- ------------------------------
Name:
E-Mail:
Telefon-Nummer:
Kommentar:
Die oben zeigt das Feld Namen in jeder Zeile, aber die Input-Daten von den Webseiten Besucher.
Unten ist der PHP-Code, schrieb ich, irgendwelche Vorschläge?
Dank CGFX
Ich habe Probleme mit der Übertragung meiner Website-Besucher Informationen aus dem HTML-Formular, um meine PHP-Datei an meine E-Mail-Adresse bezeichnet.
Alles, was ich sehe, wenn ich am geöffneten E-Mail lautet:
-------------------------------------------------- ------------------------------
Name:
E-Mail:
Telefon-Nummer:
Kommentar:
Die oben zeigt das Feld Namen in jeder Zeile, aber die Input-Daten von den Webseiten Besucher.
Unten ist der PHP-Code, schrieb ich, irgendwelche Vorschläge?
Dank CGFX
<?php
/* Subject and Email Variables */
$emailSubject = 'Contact Us!';
$webMaster = 'putEmailAddressHere';
/* Gathering Data Variables */
$name = $_POST ['name'];
$email = $_POST ['email'];
$phone = $_POST ['phone'];
$comment = $_POST ['comment'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Phone Number: $phone <br>
Comment: $comment <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Result rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>Website Name | Thank You</title>
</head>
<body>
Thank you very much, your email will be answered very soon. <a href="websiteAddressHere/">Click here</a> to go back to our site.
</body>
</html>
EOD;
echo "$theResults";
?>
/* Subject and Email Variables */
$emailSubject = 'Contact Us!';
$webMaster = 'putEmailAddressHere';
/* Gathering Data Variables */
$name = $_POST ['name'];
$email = $_POST ['email'];
$phone = $_POST ['phone'];
$comment = $_POST ['comment'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Phone Number: $phone <br>
Comment: $comment <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Result rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>Website Name | Thank You</title>
</head>
<body>
Thank you very much, your email will be answered very soon. <a href="websiteAddressHere/">Click here</a> to go back to our site.
</body>
</html>
EOD;
echo "$theResults";
?>
- <?php
- /* Subject and Email Variables */
- $emailSubject = 'Contact Us!';
- $webMaster = 'putEmailAddressHere';
- /* Gathering Data Variables */
- $name = $_POST ['name'];
- $email = $_POST ['email'];
- $phone = $_POST ['phone'];
- $comment = $_POST ['comment'];
- $body = <<<EOD
- <br><hr><br>
- Name: $name <br>
- Email: $email <br>
- Phone Number: $phone <br>
- Comment: $comment <br>
- EOD;
- $headers = "From: $email\r\n";
- $headers .= "Content-type: text/html\r\n";
- $success = mail($webMaster, $emailSubject, $body, $headers);
- /* Result rendered as HTML */
- $theResults = <<<EOD
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
- <title>Website Name | Thank You</title>
- </head>
- <body>
- Thank you very much, your email will be answered very soon. <a href="websiteAddressHere/">Click here</a> to go back to our site.
- </body>
- </html>
- EOD;
- echo "$theResults";
- ?>
- Anonymous
- Bot


- Registriert: 25 Feb 2008
- Beiträge: ?
- Loc: Ozzuland
- Status: Online
November 6th, 2009, 2:04 pm
Ein weiteres Stück Code, unten ist der Code der Form:
<div class="formContainer">
<fieldset>
<legend>Contact Us</legend>
<table width="250" border="0">
<tr>
<td width="135" class="formLabels">Name</td>
<td width="200"><form id="form1" name="form1" method="post" action="../contactformprocess.php">
<label>
<input name="name" type="text" id="name" onblur="MM_validateForm('name','','R');return document.MM_returnValue" />
</label>
</form></td>
</tr>
<tr>
<td class="formLabels">Email</td>
<td><form id="form2" name="form2" method="post" action="../contactformprocess.php">
<label onfocus="MM_validateForm('email','','RisEmail');return document.MM_returnValue">
<input name="email" type="text" id="email" onblur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" />
</label>
</form></td>
</tr>
<tr>
<td class="formLabels">Phone</td>
<td><form id="form3" name="form3" method="post" action="../contactformprocess.php">
<label>
<input name="phone" type="text" id="phone" onblur="MM_validateForm('phone','','RisNum');return document.MM_returnValue" />
</label>
</form></td>
</tr>
<tr>
<td class="formLabels"><div align="right">Comment</div></td>
<td><form id="form5" name="form5" method="post" action="../contactformprocess.php">
<label>
<textarea name="comment" id="comment" cols="21" rows="2"></textarea>
</label>
</form></td>
</tr>
</table>
<form id="form4" name="form4" method="post" action="../contactformprocess.php">
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</form>
</fieldset>
</div>
<fieldset>
<legend>Contact Us</legend>
<table width="250" border="0">
<tr>
<td width="135" class="formLabels">Name</td>
<td width="200"><form id="form1" name="form1" method="post" action="../contactformprocess.php">
<label>
<input name="name" type="text" id="name" onblur="MM_validateForm('name','','R');return document.MM_returnValue" />
</label>
</form></td>
</tr>
<tr>
<td class="formLabels">Email</td>
<td><form id="form2" name="form2" method="post" action="../contactformprocess.php">
<label onfocus="MM_validateForm('email','','RisEmail');return document.MM_returnValue">
<input name="email" type="text" id="email" onblur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" />
</label>
</form></td>
</tr>
<tr>
<td class="formLabels">Phone</td>
<td><form id="form3" name="form3" method="post" action="../contactformprocess.php">
<label>
<input name="phone" type="text" id="phone" onblur="MM_validateForm('phone','','RisNum');return document.MM_returnValue" />
</label>
</form></td>
</tr>
<tr>
<td class="formLabels"><div align="right">Comment</div></td>
<td><form id="form5" name="form5" method="post" action="../contactformprocess.php">
<label>
<textarea name="comment" id="comment" cols="21" rows="2"></textarea>
</label>
</form></td>
</tr>
</table>
<form id="form4" name="form4" method="post" action="../contactformprocess.php">
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</form>
</fieldset>
</div>
- <div class="formContainer">
- <fieldset>
- <legend>Contact Us</legend>
- <table width="250" border="0">
- <tr>
- <td width="135" class="formLabels">Name</td>
- <td width="200"><form id="form1" name="form1" method="post" action="../contactformprocess.php">
- <label>
- <input name="name" type="text" id="name" onblur="MM_validateForm('name','','R');return document.MM_returnValue" />
- </label>
- </form></td>
- </tr>
- <tr>
- <td class="formLabels">Email</td>
- <td><form id="form2" name="form2" method="post" action="../contactformprocess.php">
- <label onfocus="MM_validateForm('email','','RisEmail');return document.MM_returnValue">
- <input name="email" type="text" id="email" onblur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" />
- </label>
- </form></td>
- </tr>
- <tr>
- <td class="formLabels">Phone</td>
- <td><form id="form3" name="form3" method="post" action="../contactformprocess.php">
- <label>
- <input name="phone" type="text" id="phone" onblur="MM_validateForm('phone','','RisNum');return document.MM_returnValue" />
- </label>
- </form></td>
- </tr>
- <tr>
- <td class="formLabels"><div align="right">Comment</div></td>
- <td><form id="form5" name="form5" method="post" action="../contactformprocess.php">
- <label>
- <textarea name="comment" id="comment" cols="21" rows="2"></textarea>
- </label>
- </form></td>
- </tr>
- </table>
- <form id="form4" name="form4" method="post" action="../contactformprocess.php">
- <label>
- <input type="submit" name="submit" id="submit" value="Submit" />
- </label>
- </form>
- </fieldset>
- </div>
- righteous_trespasser
- Sold Out


- Registriert: Mär 12, 2007
- Beiträge: 6007
- Loc: South-Africa
- Status: Offline
Ich weiß nicht, ob dies einen Unterschied macht, aber die einen Versuch wert...in dem Sie erklären, wie die Variablen:
Probieren Sie es ohne den Raum wie folgt aus:
Sehen, ob das einen Unterschied macht erste.
$name = $_POST ['name'];
Probieren Sie es ohne den Raum wie folgt aus:
$name = $_POST['name'];
Sehen, ob das einen Unterschied macht erste.
RewriteEngine On
RewriteRule ^(awesome|excellent|extraordinary)$ RT
RewriteRule ^(awesome|excellent|extraordinary)$ RT
Warum haben Sie all diese Formen in den HTML-Teil? Wenn Sie, dass für das JavaScript können Sie überprüfen die Werte mit Hilfe von PHP als JavaScript. Würde die Dinge viel einfacher.
So wie eine Prüfung: siehe, wenn die folgenden hilft
smtp.class.php
formprocess.php
form.html
So wie eine Prüfung: siehe, wenn die folgenden hilft
smtp.class.php
<?php
// Mail.php
class mail
{
private $smtpServer = 'smtp.site.com';
private $port = '25';
private $timeout = 30;
private $username = 'smtp_user';
private $password = 'smtp_pass';
private $username_email = 'admin@site.com';
private $newline = "\r\n";
private $localdomain = 'site.com';
private $charset = 'windows-1251';
private $contentTransferEncoding = false;
// Do not change anything below
private $smtpConnect = false;
private $to = false;
private $subject = false;
private $message = false;
private $headers = false;
private $logArray = array(); // Array response message for debug
private $Error = '';
public function __construct($to, $subject, $message, $to2 = false) {
$this->to = (($to2 !== false)? $this->username_email : $to);
$this->subject = &$subject;
$this->message = &$message;
// Connect to server
if(!$this->Connect2Server()) {
// Display error message
echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
print_r($this->logArray);
echo $this->newline.'-->'.$this->newline;
return false;
}
return true;
}
private function Connect2Server() {
$from = (($to2 == false)? $this->username_email : $to);
// Connect to server
$this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
$this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
if (!is_resource($this->smtpConnect)) {
return false;
}
$this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
// Hi, server!
$this->sendCommand("HELO {$this->localdomain}");
$this->logArray['HELO'] = $this->readResponse();
// Let's know each other
$this->sendCommand('AUTH LOGIN');
$this->logArray['AUTH_REQUEST'] = $this->readResponse();
// My name...
$this->sendCommand(base64_encode($this->username));
$this->logArray['REQUEST_USER'] = $this->readResponse();
// My password..
$this->sendCommand(base64_encode($this->password));
$this->logArray['REQUEST_PASSWD'] = $this->readResponse();
// If error in response auth...
if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
$this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
return false;
}
// "From" mail...
$this->sendCommand("MAIL FROM: {$from}");
$this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
return false;
}
// "To" address
$this->sendCommand("RCPT TO: {$this->to}");
$this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
{
$this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
}
// Send data to server
$this->sendCommand('DATA');
$this->logArray['DATA_RESPONSE'] = $this->readResponse();
// Send mail message
if (!$this->sendMail()) return false;
// Good bye server! =)
$this->sendCommand('QUIT');
$this->logArray['QUIT_RESPONSE'] = $this->readResponse();
// Close smtp connect
fclose($this->smtpConnect);
return true;
}
// Function send mail
private function sendMail() {
$this->sendHeaders();
$this->sendCommand($this->message);
$this->sendCommand('.');
$this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
return false;
}
return true;
}
// Function read response
private function readResponse() {
$data="";
while($str = fgets($this->smtpConnect,4096))
{
$data .= $str;
if(substr($str,3,1) == " ") { break; }
}
return $data;
}
// function send command to server
private function sendCommand($string) {
fputs($this->smtpConnect,$string.$this->newline);
return ;
}
// function send headers
private function sendHeaders() {
$from = (($to2 == false)? $this->username_email : $to);
$this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
$this->sendCommand("From: <{$from}>");
$this->sendCommand("Reply-To: <{$from}>");
$this->sendCommand("To: <{$this->to}>");
$this->sendCommand("Subject: {$this->subject}");
$this->sendCommand("MIME-Version: 1.0");
$this->sendCommand("Content-Type: text/html; charset={$this->charset}");
if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
return ;
}
public function __destruct() {
if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
}
}
?>
// Mail.php
class mail
{
private $smtpServer = 'smtp.site.com';
private $port = '25';
private $timeout = 30;
private $username = 'smtp_user';
private $password = 'smtp_pass';
private $username_email = 'admin@site.com';
private $newline = "\r\n";
private $localdomain = 'site.com';
private $charset = 'windows-1251';
private $contentTransferEncoding = false;
// Do not change anything below
private $smtpConnect = false;
private $to = false;
private $subject = false;
private $message = false;
private $headers = false;
private $logArray = array(); // Array response message for debug
private $Error = '';
public function __construct($to, $subject, $message, $to2 = false) {
$this->to = (($to2 !== false)? $this->username_email : $to);
$this->subject = &$subject;
$this->message = &$message;
// Connect to server
if(!$this->Connect2Server()) {
// Display error message
echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
print_r($this->logArray);
echo $this->newline.'-->'.$this->newline;
return false;
}
return true;
}
private function Connect2Server() {
$from = (($to2 == false)? $this->username_email : $to);
// Connect to server
$this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
$this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
if (!is_resource($this->smtpConnect)) {
return false;
}
$this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
// Hi, server!
$this->sendCommand("HELO {$this->localdomain}");
$this->logArray['HELO'] = $this->readResponse();
// Let's know each other
$this->sendCommand('AUTH LOGIN');
$this->logArray['AUTH_REQUEST'] = $this->readResponse();
// My name...
$this->sendCommand(base64_encode($this->username));
$this->logArray['REQUEST_USER'] = $this->readResponse();
// My password..
$this->sendCommand(base64_encode($this->password));
$this->logArray['REQUEST_PASSWD'] = $this->readResponse();
// If error in response auth...
if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
$this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
return false;
}
// "From" mail...
$this->sendCommand("MAIL FROM: {$from}");
$this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
return false;
}
// "To" address
$this->sendCommand("RCPT TO: {$this->to}");
$this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
{
$this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
}
// Send data to server
$this->sendCommand('DATA');
$this->logArray['DATA_RESPONSE'] = $this->readResponse();
// Send mail message
if (!$this->sendMail()) return false;
// Good bye server! =)
$this->sendCommand('QUIT');
$this->logArray['QUIT_RESPONSE'] = $this->readResponse();
// Close smtp connect
fclose($this->smtpConnect);
return true;
}
// Function send mail
private function sendMail() {
$this->sendHeaders();
$this->sendCommand($this->message);
$this->sendCommand('.');
$this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
$this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
return false;
}
return true;
}
// Function read response
private function readResponse() {
$data="";
while($str = fgets($this->smtpConnect,4096))
{
$data .= $str;
if(substr($str,3,1) == " ") { break; }
}
return $data;
}
// function send command to server
private function sendCommand($string) {
fputs($this->smtpConnect,$string.$this->newline);
return ;
}
// function send headers
private function sendHeaders() {
$from = (($to2 == false)? $this->username_email : $to);
$this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
$this->sendCommand("From: <{$from}>");
$this->sendCommand("Reply-To: <{$from}>");
$this->sendCommand("To: <{$this->to}>");
$this->sendCommand("Subject: {$this->subject}");
$this->sendCommand("MIME-Version: 1.0");
$this->sendCommand("Content-Type: text/html; charset={$this->charset}");
if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
return ;
}
public function __destruct() {
if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
}
}
?>
- <?php
- // Mail.php
- class mail
- {
- private $smtpServer = 'smtp.site.com';
- private $port = '25';
- private $timeout = 30;
- private $username = 'smtp_user';
- private $password = 'smtp_pass';
- private $username_email = 'admin@site.com';
- private $newline = "\r\n";
- private $localdomain = 'site.com';
- private $charset = 'windows-1251';
- private $contentTransferEncoding = false;
- // Do not change anything below
- private $smtpConnect = false;
- private $to = false;
- private $subject = false;
- private $message = false;
- private $headers = false;
- private $logArray = array(); // Array response message for debug
- private $Error = '';
- public function __construct($to, $subject, $message, $to2 = false) {
- $this->to = (($to2 !== false)? $this->username_email : $to);
- $this->subject = &$subject;
- $this->message = &$message;
- // Connect to server
- if(!$this->Connect2Server()) {
- // Display error message
- echo '<pre>'.trim($this->Error).'</pre>'.$this->newline.'<!-- '.$this->newline;
- print_r($this->logArray);
- echo $this->newline.'-->'.$this->newline;
- return false;
- }
- return true;
- }
- private function Connect2Server() {
- $from = (($to2 == false)? $this->username_email : $to);
- // Connect to server
- $this->smtpConnect = fsockopen($this->smtpServer,$this->port,$errno,$error,$this->timeout);
- $this->logArray['CONNECT_RESPONSE'] = $this->readResponse();
- if (!is_resource($this->smtpConnect)) {
- return false;
- }
- $this->logArray['connection'] = "Connection accepted: {$smtpResponse}";
- // Hi, server!
- $this->sendCommand("HELO {$this->localdomain}");
- $this->logArray['HELO'] = $this->readResponse();
- // Let's know each other
- $this->sendCommand('AUTH LOGIN');
- $this->logArray['AUTH_REQUEST'] = $this->readResponse();
- // My name...
- $this->sendCommand(base64_encode($this->username));
- $this->logArray['REQUEST_USER'] = $this->readResponse();
- // My password..
- $this->sendCommand(base64_encode($this->password));
- $this->logArray['REQUEST_PASSWD'] = $this->readResponse();
- // If error in response auth...
- if (substr($this->logArray['REQUEST_PASSWD'],0,3)!='235') {
- $this->Error .= 'Authorization error! '.$this->logArray['REQUEST_PASSWD'].$this->newline;
- return false;
- }
- // "From" mail...
- $this->sendCommand("MAIL FROM: {$from}");
- $this->logArray['MAIL_FROM_RESPONSE'] = $this->readResponse();
- if (substr($this->logArray['MAIL_FROM_RESPONSE'],0,3)!='250') {
- $this->Error .= 'Mistake in sender\'s address! '.$this->logArray['MAIL_FROM_RESPONSE'].$this->newline;
- return false;
- }
- // "To" address
- $this->sendCommand("RCPT TO: {$this->to}");
- $this->logArray['RCPT_TO_RESPONCE'] = $this->readResponse();
- if(substr($this->logArray['RCPT_TO_RESPONCE'],0,3) != '250')
- {
- $this->Error .= 'Mistake in reciepent address! '.$this->logArray['RCPT_TO_RESPONCE'].$this->newline;
- }
- // Send data to server
- $this->sendCommand('DATA');
- $this->logArray['DATA_RESPONSE'] = $this->readResponse();
- // Send mail message
- if (!$this->sendMail()) return false;
- // Good bye server! =)
- $this->sendCommand('QUIT');
- $this->logArray['QUIT_RESPONSE'] = $this->readResponse();
- // Close smtp connect
- fclose($this->smtpConnect);
- return true;
- }
- // Function send mail
- private function sendMail() {
- $this->sendHeaders();
- $this->sendCommand($this->message);
- $this->sendCommand('.');
- $this->logArray['SEND_DATA_RESPONSE'] = $this->readResponse();
- if(substr($this->logArray['SEND_DATA_RESPONSE'],0,3)!='250') {
- $this->Error .= 'Mistake in sending data! '.$this->logArray['SEND_DATA_RESPONSE'].$this->newline;
- return false;
- }
- return true;
- }
- // Function read response
- private function readResponse() {
- $data="";
- while($str = fgets($this->smtpConnect,4096))
- {
- $data .= $str;
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
- // function send command to server
- private function sendCommand($string) {
- fputs($this->smtpConnect,$string.$this->newline);
- return ;
- }
- // function send headers
- private function sendHeaders() {
- $from = (($to2 == false)? $this->username_email : $to);
- $this->sendCommand("Date: ".date("D, j M Y G:i:s")." +0700");
- $this->sendCommand("From: <{$from}>");
- $this->sendCommand("Reply-To: <{$from}>");
- $this->sendCommand("To: <{$this->to}>");
- $this->sendCommand("Subject: {$this->subject}");
- $this->sendCommand("MIME-Version: 1.0");
- $this->sendCommand("Content-Type: text/html; charset={$this->charset}");
- if ($this->contentTransferEncoding) $this->sendCommand("Content-Transfer-Encoding: {$this->contentTransferEncoding}");
- return ;
- }
- public function __destruct() {
- if (is_resource($this->smtpConnect)) fclose($this->smtpConnect);
- }
- }
- ?>
formprocess.php
<?php
/* Some required variables to configure this page */
// Variables not to be sent to you
$blocked = array('submit1');
// The email address the result of the form would be sent to.
$adm_email = 'your_email@your_host.com'
// The prefix to the mail
$mail_prefix = '<br /><hr /><br />';
// The post (signature) to the mail
$mail_post = null;
// The title for the message
$title = 'A message was sent to you!';
/* The actual code body for sending */
// Initiating the body var
$body = $mail_prefix;
// Initiating some numeric values that would be incremented in the following loop
$blocked_num = 0;
// Building the body for the mail
foreach($_POST as $field_name => $field_value)
// Building the body for the mail with the correct fields
if(!in_array($field_name, $blocked))
$body .= "<strong>{$field_name}</strong>: {$_POST[$field_value]}<br />\r\n";
// Ending the body var
$body .= $mail_post;
// Trimming the ends of body from any unneeded white spaces
$body = trim($body);
// Requiring the SMTP class
require_once 'smtp.class.php';
// Initiating the mail object
$mail = new mail();
// Sending the message
//if(new mail($_POST['email'], $title, $body, true))
// echo 'The mail was successfully sent. Thank you for your time!';
//else
// echo 'There was an error in the mailling service.';
echo $body;
?>
/* Some required variables to configure this page */
// Variables not to be sent to you
$blocked = array('submit1');
// The email address the result of the form would be sent to.
$adm_email = 'your_email@your_host.com'
// The prefix to the mail
$mail_prefix = '<br /><hr /><br />';
// The post (signature) to the mail
$mail_post = null;
// The title for the message
$title = 'A message was sent to you!';
/* The actual code body for sending */
// Initiating the body var
$body = $mail_prefix;
// Initiating some numeric values that would be incremented in the following loop
$blocked_num = 0;
// Building the body for the mail
foreach($_POST as $field_name => $field_value)
// Building the body for the mail with the correct fields
if(!in_array($field_name, $blocked))
$body .= "<strong>{$field_name}</strong>: {$_POST[$field_value]}<br />\r\n";
// Ending the body var
$body .= $mail_post;
// Trimming the ends of body from any unneeded white spaces
$body = trim($body);
// Requiring the SMTP class
require_once 'smtp.class.php';
// Initiating the mail object
$mail = new mail();
// Sending the message
//if(new mail($_POST['email'], $title, $body, true))
// echo 'The mail was successfully sent. Thank you for your time!';
//else
// echo 'There was an error in the mailling service.';
echo $body;
?>
- <?php
- /* Some required variables to configure this page */
- // Variables not to be sent to you
- $blocked = array('submit1');
- // The email address the result of the form would be sent to.
- $adm_email = 'your_email@your_host.com'
- // The prefix to the mail
- $mail_prefix = '<br /><hr /><br />';
- // The post (signature) to the mail
- $mail_post = null;
- // The title for the message
- $title = 'A message was sent to you!';
- /* The actual code body for sending */
- // Initiating the body var
- $body = $mail_prefix;
- // Initiating some numeric values that would be incremented in the following loop
- $blocked_num = 0;
- // Building the body for the mail
- foreach($_POST as $field_name => $field_value)
- // Building the body for the mail with the correct fields
- if(!in_array($field_name, $blocked))
- $body .= "<strong>{$field_name}</strong>: {$_POST[$field_value]}<br />\r\n";
- // Ending the body var
- $body .= $mail_post;
- // Trimming the ends of body from any unneeded white spaces
- $body = trim($body);
- // Requiring the SMTP class
- require_once 'smtp.class.php';
- // Initiating the mail object
- $mail = new mail();
- // Sending the message
- //if(new mail($_POST['email'], $title, $body, true))
- // echo 'The mail was successfully sent. Thank you for your time!';
- //else
- // echo 'There was an error in the mailling service.';
- echo $body;
- ?>
form.html
<form method="post" action="formprocess.php">
<input type="text" name="name1" size="10" />
<input type="text" name="name2" size="10" />
<input type="text" name="name3" size="10" />
<input type="text" name="name4" size="10" />
<input type="text" name="name5" size="10" />
<input type="text" name="name6" size="10" />
<input type="submit" name="submit" value="submit" />
</form>
<input type="text" name="name1" size="10" />
<input type="text" name="name2" size="10" />
<input type="text" name="name3" size="10" />
<input type="text" name="name4" size="10" />
<input type="text" name="name5" size="10" />
<input type="text" name="name6" size="10" />
<input type="submit" name="submit" value="submit" />
</form>
- <form method="post" action="formprocess.php">
- <input type="text" name="name1" size="10" />
- <input type="text" name="name2" size="10" />
- <input type="text" name="name3" size="10" />
- <input type="text" name="name4" size="10" />
- <input type="text" name="name5" size="10" />
- <input type="text" name="name6" size="10" />
- <input type="submit" name="submit" value="submit" />
- </form>
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
Seite 1 von 1
Um Antworten zu diesem Thema müssen Sie sich einloggen oder registrieren. Es ist kostenlos.
Buchung Informationen
- Beiträge in diesem Thema: 8 Beiträge
- Mitglieder in diesem Forum: 0 Mitglieder und 346 Gäste
- Du darfst keine neuen Themen in diesem Forum erstellen.
- Du darfst keine Antworten zu Themen in diesem Forum erstellen.
- Du darfst deine Beiträge in diesem Forum nicht ändern.
- Du darfst deine Beiträge in diesem Forum nicht löschen.
- Du darfst keine Dateianhänge in diesem Forum erstellen.


