Código HTML:
<form name="form1" method="post" action="enviar.php"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Nombre:</td> <td> <input type="text" name="nombre" size="30"> </td> </tr> <tr> <td>Dirección:</td> <td><input type="text" name="direccion" size="30"></td> </tr> <tr> <td>Teléfono:</td> <td><input type="text" name="telefono" size="30"></td> </tr> <tr> <td> </td> <td> </td> </tr> <td><input type="submit" name="submit" value="enviar"></td> </table> </form> <?PHP $Link=mysql_connect ("localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("base")or die("Error select db ".mysql_error()); foreach($HTTP_POST_VARS as $varname => $value) $formVars[$varname]=$value; include("db.php"); $result = mysql_query("SELECT * FROM emp INNER JOIN prod ON emp.prodid = prod.productid WHERE emp.empreid = '" . Getemp() . "' ORDER BY prod.productnom ASC"); while($row = mysql_fetch_array($result)) { echo "<td>".$row["productnom"]."</td> \n"; echo "<td>".$row["cant"]."</td> \n"; echo "<td>".$row["precio"]."</td> \n"; echo "</tr> \n"; } ?>
Para el formulario tengo este código:
Código PHP:
<?
$cuerpo .= "<b>Nombre:</b> " . $_POST["nombre"] . "\n";
$cuerpo .= "<b>Dirección:</b> " . $_POST["direccion"] . "\n";
$cuerpo .= "<b>Teléfono:</b> " . $_POST["telefono"] . "\n";
$cuerpo = nl2br($cuerpo);
$to = "[email protected]";
$subject = "$nombre - Consulta";
$mailheader = "MIME-Version: 1.0 \r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$mailheader .= "From: Formulario de Consulta \r\n";
$mailheader .= "Return-path: \r\n";
$mailheader .= "X-Priority: 1 \r\n";
$mailheader .= "X-MSMail-Priority: High \r\n";
$mailheader .= "X-Mailer: PHP/".phpversion()." \n";
if (mail ($to,$subject,$cuerpo,$mailheader))
?>
La verdad es que busqué ejemplos, pero no encontré nada que me soluciones el inconveniente, ojalá alguno de ustedes me puedan ayudar...
Gracias!!!