Ver Mensaje Individual
  #18 (permalink)  
Antiguo 07/04/2009, 08:57
Frankedeke
 
Fecha de Ingreso: marzo-2009
Mensajes: 12
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Cojer todas las variables y enviar por mail

En mi caso, tengo todo el código en el mismo archivo, queda así:

<?php require_once('Connections/nnn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO Clientes (CLnombre_razonsocial, CLapellido1, CLapellido2, CLdni, CLdireccion1, CLcp, CLlocalidad, CLprovincia, CLtelefono, CLmovil, .....) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombresolicitante'], "text"),
GetSQLValueString($_POST['apellido1solic'], "text"),
GetSQLValueString($_POST['apellido2solici'], "text"),
GetSQLValueString($_POST['dnisolicitante'], "text"),
GetSQLValueString($_POST['direccionsolici'], "text"),
.

mysql_select_db($database_nnn, $nnn);
$Result1 = mysql_query($insertSQL, $nnn) or die(mysql_error());
}
?>

El código anterior actua al pulsar el botón de "Confirmar y enviar"
Los campos se validan con funciones del siguiente tipo:


<td><span id="sprytextfield16">
<input name="nombresolicitante" type="text" id="nombresolicitante" value="<?php echo $row_Recordset1['CLnombre_razonsocial']; ?>" size="50" maxlength="50" />
<span class="textfieldRequiredMsg">Se necesita un valor.</span></span></td>


Así que no tengo claro dónde colocar el código necesario para enviar los correos, a continuación, en el comienzo de la página o en archivo aparte.