Código PHP:
Warning: Failed to Connect in c:program fileseasyphpwwwmsenviarm.php on line 87
Gracias por rellenar el formulario. Se ha enviado correctamente.
Código PHP:
<?php include('Connections/oMsolution.php'); ?>
<?php
mysql_select_db($database_oMsolution, $oMsolution);
$query_rsEmail = "SELECT * FROM carros WHERE Id ='$Id'";
$rsEmail = mysql_query($query_rsEmail, $oMsolution) or die(mysql_error());
$row_rsEmail = mysql_fetch_assoc($rsEmail);
$totalRows_rsEmail = mysql_num_rows($rsEmail);
?>
<html>
<head>
<title>Enviar Email desde Base de Datos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
if (!$HTTP_POST_VARS){
?>
<form name="form1" method="post" action="<?php $PHP_SELF ?>">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="50%">
<input name="id" type="hidden" id="id" value="<?php echo $row_rsEmail['Id']; ?>">
<input name="make" type="hidden" value="<?php echo $row_rsEmail['make']; ?>">
<input name="model" type="hidden" value="<?php echo $row_rsEmail['model']; ?>">
<input name="price" type="hidden" value="<?php echo $row_rsEmail['price']; ?>"></td>
<td width="50%"> </td>
</tr>
<tr>
<td align="right">Name:</td>
<td><input name="name" type="text">
</td>
</tr>
<tr>
<td align="right">Phone:</td>
<td><input name="phone" type="text">
</td>
</tr>
<tr>
<td align="right">Email:</td>
<td><input name="email" type="text">
</td>
</tr>
<tr>
<td align="right">Payment:</td>
<td>Cashier Check
<input type="checkbox" name="checkbox" value="Check">
Money Transfer
<input type="checkbox" name="checkbox" value="Transfer">
</td>
</tr>
<tr>
<td align="right" valign="top">Comments:</td>
<td valign="top"><textarea name="comments" cols="40" rows="8"></textarea>
</td>
</tr>
<tr>
<td align="right"> </td>
<td><input type="submit" name="Enviar" value="Submit">
<input type="reset" name="reset" value="Reset">
</td>
</tr>
<tr>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td> </td>
</tr>
</table>
</form>
<?php
}else{
//Estoy recibiendo el formulario, compongo el cuerpo
$cuerpo = "Formulario enviado\n";
$cuerpo .= "Vehicle ID: " . $HTTP_POST_VARS["id"] . "\n";
$cuerpo .= "Make: " . $HTTP_POST_VARS["make"] . "\n";
$cuerpo .= "Model: " . $HTTP_POST_VARS["model"] . "\n";
$cuerpo .= "Name: " . $HTTP_POST_VARS["name"] . "\n";
$cuerpo .= "Phone: " . $HTTP_POST_VARS["phone"] . "\n";
$cuerpo .= "Email: " . $HTTP_POST_VARS["email"] . "\n";
$cuerpo .= "Payment: " . $HTTP_POST_VARS["checkbox"] . "\n";
$cuerpo .= "Comments: " . $HTTP_POST_VARS["comments"] . "\n";
//mando el correo...
mail("[email protected]","Formulario recibido",$cuerpo);
//doy las gracias por el envío
echo "Gracias por rellenar el formulario. Se ha enviado correctamente.";
}?>
</body>
</html>
<?php
mysql_free_result($rsEmail);
?>
Código PHP:
mail("[email protected]","Formulario recibido",$cuerpo);