Foros del Web » Programando para Internet » Javascript »

Problemas con DESORDEN formulario MAIL

Estas en el tema de Problemas con DESORDEN formulario MAIL en el foro de Javascript en Foros del Web. Hola Pues les escribo porque necesito de su ayuda. Estoy creando un carrito de compra para mi pagina web, baje un programa y todo bien. ...
  #1 (permalink)  
Antiguo 18/06/2009, 23:06
 
Fecha de Ingreso: junio-2009
Mensajes: 8
Antigüedad: 14 años, 10 meses
Puntos: 0
Problemas con DESORDEN formulario MAIL

Hola


Pues les escribo porque necesito de su ayuda. Estoy creando un carrito de compra para mi pagina web, baje un programa y todo bien. el problema es el siguiente:

Al enviarme el correo desde el carrito este me llega de la siguiente forma.

NOMBRE:
TELEFONO:
PRODUCTO:
CANTIDAD:
MONTO:
PRODUCTO2:
CANTIDAD2:
MONTO2:
PRODUCTO3:
CANTIDAD3:
MONTO3:

Mi pregunta es, alguien sabe como poder ordenar eso, ya que los listados son un desorden, me gustaria que quedara algo asi o que ordene la informacion al enviar el mail:

NOMBRE:
TELEFONO:
---------------------------------------
PRODUCTO:
CANTIDAD:
MONTO:
---------------------------------------
PRODUCTO2:
CANTIDAD2:
MONTO2:
---------------------------------------

LES DEJO EL formulario:

<html>
<head>
<title>Formulario</title>
<style type="text/css">
.body {
font-family: Arial;
font-size: 10pt;
font-style: normal;
font-weight: normal;
font-variant: normal;
color: #FFFFFF;
}

.td {
font-family: Arial;
font-size: 10pt;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #FFFFFF;
}


</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Enviar(form) {
for (i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "text" && form.elements[i].value == "") {
alert("Por favor complete todos los campos del formulario"); form.elements[i].focus();
return false; }
}
form.submit();
}
// -->
</SCRIPT>
</head>
<body bgcolor="#000000" link="#32468D" vlink="#800080" class="body">
<SCRIPT LANGUAGE="JavaScript">

function alterError(value) {
if (value<=0.99) {
newPounds = '0';
} else {
newPounds = parseInt(value);
}
newPence = parseInt((value+.0008 - newPounds)* 100);
if (eval(newPence) <= 9) newPence='0'+newPence;
newString = newPounds + '.' + newPence;
return (newString);
}

function showItems() {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
fulllist = document.cookie.substring(countbegin, countend);
totprice = 0;

itemlist = 0;
for (var i = 0; i <= fulllist.length; i++) {
if (fulllist.substring(i,i+1) == '[') {
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == ']') {
itemend = i;
thequantity = fulllist.substring(itemstart, itemend);
itemtotal = 0;
itemtotal = (eval(theprice*thequantity));
temptotal = itemtotal * 100;
var tax = itemtotal / 100 * (0 - 0);
tax = Math.floor(tax * 100)/100
totprice = totprice + itemtotal + tax;
itemlist=itemlist+1;

document.writeln('<INPUT TYPE="hidden" NAME="PRODUCTO'+itemlist+'" VALUE="'+theitem+'" SIZE="40">');
document.writeln('<INPUT TYPE="hidden" NAME="CANTIDAD'+itemlist+'" VALUE="'+thequantity+'" SIZE="40">')
document.writeln('<INPUT TYPE="hidden" NAME="MONTO'+itemlist+'" VALUE="'+alterError(itemtotal)+'" SIZE="40">');
} else if (fulllist.substring(i,i+1) == ',') {
theitem = fulllist.substring(itemstart, i);
itemstart = i+1;
} else if (fulllist.substring(i,i+1) == '#') {
theprice = fulllist.substring(itemstart, i);
itemstart = i+1;
}
}

document.writeln('<INPUT TYPE="hidden" NAME="Total" VALUE="'+alterError(totprice)+'" SIZE="40">');

}
function Total() {
document.writeln(alterError(totprice));
}

</SCRIPT>
<center>
<table border="0" cellpadding="0" cellspacing="0" width="640" class="body">
<tr>
<td width="50%"><big><big>Formulario</big></big></td>
<td width="50%" align="right">[ <a href="carrito.htm">Listado de Productos</a> | <a href="estado.htm">Estado</a> | Formulario ]</td>
</tr>
<tr>
<td width="100%" colspan="2">
<hr size="1" color="#FFFFFF">
</td>
</tr>
<tr>
<td width="100%" colspan="2"></td>
</tr>
</table>

<FORM method="post" action="enviar.php" target="_top">


<table cols="2" width="370" class="body">
<td width="130"></td>
<td width="270">
</td>
</tr>
<tr><td>NOMBRE</td><td><input type="text" name="NOMBRE" size=34></td></tr>
<tr><td>DOMICILIO</td><td><input type="text" name="DOMICILIO" size=34></td></tr>
<tr><td>COMUNA</td><td><input type="text" name="COMUNA" size=34></td></tr>
<tr><td>EMAIL</td><td><input type="text" name="EMAIL" size=34></td></tr>
<tr><td>TELEFONO</td><td><input type="text" name="TELEFONO" size=34></td></tr>
<tr><td>DATOS EXTRAS</td><td><input type="text" name="DATOS EXTRAS" size=34></td></tr>

<SCRIPT LANGUAGE="JavaScript">
showItems();
</SCRIPT>
<tr>
<td>Total:</td>
<td>$
<SCRIPT LANGUAGE="JavaScript">Total()</SCRIPT>
</td>
</tr>

<tr>
<td><br><br></td>
<td>
<input type="button" value="Enviar" onClick="return Enviar(this.form)">
<input type="reset" value="Borrar">
</td>
</tr>
</table>
</form>

</center>
</body>
</html>


***********************************************

EL PHP


<?
$MailToAddress = "";
$MailSubject = "XXX";
if (!$MailFromAddress) {
$MailFromAddress = "";
}

$Header = " - Orden de Compra";
$Footer = "";

if (!is_array($HTTP_POST_VARS))
return;
reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
$val=stripslashes($val);
$Message .= "$key = $val\n";
}

if ($Header) {
$Message = $Header."\n\n".$Message."\n\n";
}


$Message.= "Enviado desde : ".$_SERVER["REMOTE_ADDR"];


if ($Footer) {
$Message .= "\n\n".$Footer;
}

mail( "$MailToAddress", "$MailSubject", "$Message", "From: $MailFromAddress");
header ("Location: ");
?>


Gracias por la ayuda DESDE YA... SALUDOS¡¡¡¡
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:05.