PHP el Formulario
Ozzu,
Estoy teniendo problemas con la transferencia de la información de mi visitante del sitio Web de la forma HTML a mi archivo PHP a mi dirección de correo electrónico designada.
Todo lo que veo cuando abro el correo electrónico am es la siguiente:
-------------------------------------------------- ------------------------------
Nombre:
Email:
Número de Teléfono:
Comentario:
La muestra sobre el nombre de campo de cada fila, pero los datos de entrada de los visitantes de sitios web.
A continuación se muestra el código PHP que escribí, alguna sugerencia?
Gracias CgFX
Estoy teniendo problemas con la transferencia de la información de mi visitante del sitio Web de la forma HTML a mi archivo PHP a mi dirección de correo electrónico designada.
Todo lo que veo cuando abro el correo electrónico am es la siguiente:
-------------------------------------------------- ------------------------------
Nombre:
Email:
Número de Teléfono:
Comentario:
La muestra sobre el nombre de campo de cada fila, pero los datos de entrada de los visitantes de sitios web.
A continuación se muestra el código PHP que escribí, alguna sugerencia?
Gracias 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


- Registrado: 25 Feb 2008
- Mensajes: ?
- Loc: Ozzuland
- Status: Online
Noviembre 6th, 2009, 2:04 pm
Otro pedacito de código, a continuación es el código de la siguiente forma:
<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


- Registrado: Mar 12, 2007
- Mensajes: 6007
- Loc: South-Africa
- Status: Offline
No sé si esto va a marcar una diferencia, pero vale la pena intentarlo...donde se declaran las variables como:
probar sin el espacio como este:
A ver si eso hace una primera diferencia.
$name = $_POST ['name'];
probar sin el espacio como este:
$name = $_POST['name'];
A ver si eso hace una primera diferencia.
RewriteEngine On
RewriteRule ^(awesome|excellent|extraordinary)$ RT
RewriteRule ^(awesome|excellent|extraordinary)$ RT
¿Por qué tienen todos los formularios en la parte HTML? Si usted necesita que para el código JavaScript, puede validar los valores usando PHP en vez de JavaScript. Haría las cosas mucho más fácil.
Así como una prueba: ver si la siguiente ayuda
smtp.class.php
formprocess.php
form.html
Así como una prueba: ver si la siguiente ayuda
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.
Página 1 de 1
Para responder a este tema que necesita para ingresar o registrarse. Es gratis.
Publicar Información
- Total de mensajes en este tema: 8 mensajes
- Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 225 invitados
- No puede abrir nuevos temas en este Foro
- No puede responder a temas en este Foro
- No puede editar sus mensajes en este Foro
- No puede borrar sus mensajes en este Foro
- No puede enviar adjuntos en este Foro


