Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/12/2011, 05:51
rafaxusirati
 
Fecha de Ingreso: julio-2010
Ubicación: Cerca Sitges (Barcelona)
Mensajes: 98
Antigüedad: 13 años, 9 meses
Puntos: 4
Enviar formulario de contacto sin mostrar email del destinatario

Hola a todos.

Tengo una página que tiene una base de datos con posibles clientes con los siguientes campos (ref. Nombre usuario, mailcontacto, titulo...).

Tengo 3 formularios.

1º Form. aparece el listado de posibles clientes que se encuentran ya introducidos en la base de datos (referencia, nombre y trabajo a realizar)

2º Form. la persona que quiera contactar con el futuro cliente del form.1, tiene que rellenar un formulario, que será enviado al cliente del form.1

2º Form. igual que el anterior, pero con acceso a base de datos

3º Form. donde supuestamente se debería de enviar la información introducida en el form.2 a los clientes del form.1


los form.2, supuestamente son iguales, pero 1 tiene acceso a la base de datos, donde se supone que tendría que obtener la información del mail, donde posteriormente enviará la información.

Lo que pretendo es que, la persona que quiera contactar con uno de los clientes del listado del form.1 pueda hacerlo, pero sin que pueda saber su mail. Para ello tendrá que rellenar un formulario (form.2) introduciendo su nombre, mail, y un posible mensaje).
Posteriormente, la persona del form.1, recibiría los datos de la persona que quiere contactar con el.

En ningun momento, me interesa que se muestre el mail del listado form.1.

¿cómo se pueden arreglar los códigos?

Muchas gracias.


form1.

Código PHP:
Ver original
  1. <?php require_once('../Connections/contactos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $maxRows_Recordset1 = 10;
  35. $pageNum_Recordset1 = 0;
  36. if (isset($_GET['pageNum_Recordset1'])) {
  37.   $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
  38. }
  39. $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
  40.  
  41. mysql_select_db($database_contactos, $contactos);
  42. $query_Recordset1 = "SELECT * FROM contactos ORDER BY fechaentrada DESC";
  43. $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
  44. $Recordset1 = mysql_query($query_limit_Recordset1, $contactos) or die(mysql_error());
  45. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  46.  
  47. if (isset($_GET['totalRows_Recordset1'])) {
  48.   $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
  49. } else {
  50.   $all_Recordset1 = mysql_query($query_Recordset1);
  51.   $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
  52. }
  53. $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
  54. ?>
  55.  
  56. <p>Clientes mantenimiento comunitario.</p>
  57. <?php do { ?>
  58.   <table width="50%" border="0">
  59.     <tr>
  60.       <td><div align="left">ref: <?php echo $row_Recordset1['idempleado']; ?></div></td>
  61.     </tr>
  62.     <tr>
  63.       <td><div align="left">Nombre: <a href="http://mipaginadejardineria/contactar.php"><?php echo $row_Recordset1['nombre']; ?></a></div></td>
  64.     </tr>
  65.     <tr>
  66.       <td><div align="left">Faena a realizar: <?php echo $row_Recordset1['tituloanuncio']; ?></div></td>
  67.     </tr>
  68.   </table>
  69.   <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  70. <p>&nbsp;</p>
  71. <?php
  72. mysql_free_result($Recordset1);
  73. ?>

form.2

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Fornmulario de Contacto</title>
  6. </head>
  7.  
  8. <body>
  9. <h3>Formulario de Contactos</h3>
  10. <form id="form1" name="form1" method="post" action="procesar.php">
  11.   <label> Ingrese su nombre <br />
  12.   <input name="nombre" type="text" id="nombre" />
  13.   <br />
  14.   </label>
  15.   <p>Su direcci&oacute;n Email<br />
  16.     <input name="email" type="text" id="email" />
  17.   </p>
  18.   <p>Su N&uacute;mero de tel&eacute;fono <br />
  19.     <input name="telefono" type="text" id="telefono" />
  20. </p>
  21.   <p>Tipo de contacto y tratamiento<br />
  22.     <label>
  23.       <select name="tipo" id="tipo">
  24.         <option value="primavera">Primavera</option>
  25.         <option value="verano">Verano</option>
  26.         <option value="Oto&ntilde;o">Oto&ntilde;o</option>
  27.         <option value="invierno">Invierno</option>
  28.       </select>
  29.     </label>
  30.   </p>
  31.   <p>
  32.     <label>Mensaje<br />
  33.     <textarea name="mensaje" cols="30" rows="3" id="mensaje"></textarea>
  34.     </label>
  35. </p>
  36.   <p>
  37.     <label>
  38.     <input type="submit" name="Submit" value="Enviar Formulario &gt;&gt;" />
  39.     </label>
  40.   </p>
  41.   <p><br />
  42.   </p>
  43. </form>
  44.  
  45. </body>
  46. </html>


form.3

Código PHP:
Ver original
  1. <?php require_once('../Connections/contactos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. mysql_select_db($database_contactos, $contactos);
  35. $query_Recordset1 = "SELECT * FROM contactos ORDER BY fechaentrada DESC";
  36. $Recordset1 = mysql_query($query_Recordset1, $contactos) or die(mysql_error());
  37. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  38. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  39.  
  40. // ¿supuestamente, aquí debería de obtenerse los datos del EMAIL DE LA BASE DE DATOS?
  41. $para = '[email protected]';
  42.  
  43. $asunto = $_POST["tipo"];
  44. $mailheader = "From: ".$_POST["email"]."\r\n";
  45. $mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
  46. $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
  47. $MESSAGE_BODY = "Nombre: ".$_POST["nombre"]."<br>";
  48. $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
  49. $MESSAGE_BODY .= "Telefono: ".$_POST["telefono"]."<br>";
  50. $MESSAGE_BODY .= "Tipo de contacto: ".$_POST["tipo"]."<br>";
  51. $MESSAGE_BODY .= "Mensaje: ".nl2br($_POST["mensaje"])."<br>";
  52. mail($para, $asunto, $MESSAGE_BODY, $mailheader) or die ("Error al enviar el Formulario !");
  53.  
  54. //MODIFICAR A LA DIRECCIÓN EN SU SERVIDOR
  55. header( 'Location: http://mipaginadejardineria/gracias.html' )
  56.  
  57. mysql_free_result($Recordset1);
  58. ?>