Foros del Web » Programando para Internet » PHP »

quien me solucina este problema

Estas en el tema de quien me solucina este problema en el foro de PHP en Foros del Web. Tengo un formulario. y no se como hacer y que cambiar para que redireccione a otra direccion web. Muchas gracias Código PHP:           //Message sent!           //It the message that will be displayed when the user click the sumbit button           //You can modify the text if you want ...
  #1 (permalink)  
Antiguo 12/10/2010, 17:30
Avatar de orllo55  
Fecha de Ingreso: junio-2006
Mensajes: 44
Antigüedad: 17 años, 10 meses
Puntos: 0
quien me solucina este problema

Tengo un formulario. y no se como hacer y que cambiar para que redireccione a otra direccion web.
Muchas gracias
Código PHP:

          //Message sent!
          //It the message that will be displayed when the user click the sumbit button
          //You can modify the text if you want
          echo nl2br("
           <div class=\"MsgSent\">
            <h1>Correcto</h1>
            <p>Su mensaje <b><?=$name;?></b>, se ha enviado correctamente!<br /> En 24H nos pondremos en contacto con unsted.</p>
        </div>
       ");

           else

        // Display error message if the message failed to send
        echo "
           <div class=\"MsgError\">
            <h1>Error!!</h1>
            <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p>
        </div>";
    }
  #2 (permalink)  
Antiguo 12/10/2010, 17:33
Avatar de CazaresLuis  
Fecha de Ingreso: septiembre-2010
Ubicación: Distrito Federal
Mensajes: 67
Antigüedad: 13 años, 7 meses
Puntos: 2
Información Respuesta: quien me solucina este problema

Cita:
Iniciado por orllo55 Ver Mensaje
Tengo un formulario. y no se como hacer y que cambiar para que redireccione a otra direccion web.
Muchas gracias
Código PHP:

          //Message sent!
          //It the message that will be displayed when the user click the sumbit button
          //You can modify the text if you want
          echo nl2br("
           <div class=\"MsgSent\">
            <h1>Correcto</h1>
            <p>Su mensaje <b><?=$name;?></b>, se ha enviado correctamente!<br /> En 24H nos pondremos en contacto con unsted.</p>
        </div>
       ");

           else

        // Display error message if the message failed to send
        echo "
           <div class=\"MsgError\">
            <h1>Error!!</h1>
            <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p>
        </div>";
    }
Si pones el código completo estaría mejor porque no se entiende

Saludos
  #3 (permalink)  
Antiguo 12/10/2010, 17:46
Avatar de orllo55  
Fecha de Ingreso: junio-2006
Mensajes: 44
Antigüedad: 17 años, 10 meses
Puntos: 0
Respuesta: quien me solucina este problema

Código PHP:
Ver original
  1. //User info (DO NOT EDIT!)
  2. $name = stripslashes($_POST['nombre']); //sender's name
  3. $apellidos = stripslashes($_POST['apellidos']); //sender's name
  4. $email = stripslashes($_POST['email']); //sender's email
  5. $website = stripslashes($_POST['telefono']); //sender's website
  6.  
  7. //The subject
  8. $subject .= stripslashes($_POST['asunto']); // the subject
  9.  
  10.  
  11.  
  12. //The message you will receive in your mailbox
  13. //Each parts are commented to help you understand what it does exaclty.
  14. //YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
  15. $msg  = "From : $name \r\n";  //add sender's name to the message
  16. $msg .= "apellidos : $apellidos \r\n";  //add sender's email to the message
  17. $msg .= "e-Mail : $email \r\n";  //add sender's email to the message
  18. $msg .= "Website : $website \r\n"; //add sender's website to the message
  19. $msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway)
  20. $msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n";  //the message itself
  21.  
  22.  
  23. //Extras: User info (Optional!)
  24. //Delete this part if you don't need it
  25. //Display user information such as Ip address and browsers information...
  26. $msg .= "---User information--- \r\n"; //Title
  27. $msg .= "User IP : ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
  28. $msg .= "Browser info : ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
  29. $msg .= "User come from : ".$_SERVER["HTTP_REFERER"]; //Referrer
  30. // END Extras
  31.  
  32. ?>
  33.  
  34. <head>
  35. <title></title>
  36. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  37. <meta name="description" content="Ajax Contact form using CheckForm2 and NiceForms." />
  38. <meta name="keywords" content="php, contact form, Ajax, mootools, checkform2, niceforms, Moo Floor, class, javascript, spamcheck, badboy.ro" />
  39. <meta name="author" content="Jeremie Tisseau" />
  40.  
  41.  
  42. <script type="text/javascript" src="js/mootools.js"></script>
  43.  
  44. <!-- Formcheck2 / Moo.Floor.ch -->
  45. <!-- http://moo.floor.ch/?p=18 -->
  46. <script type="text/javascript" src="js/formcheck.js"></script>
  47. <script type="text/javascript">
  48.     window.addEvent('domready', function(){check = new FormCheck('third', {
  49.         display : {
  50.             fadeDuration : 500,
  51.             errorsLocation : 1,
  52.             indicateErrors : 1,
  53.             showErrors : 1
  54.         }
  55.     })});
  56. </script>
  57.  
  58. <!-- NiceForms / BadBoy.ro -->
  59. <!-- http://www.badboy.ro/articles/2005-07-23/niceforms_preview/ -->
  60. <script type="text/javascript" src="js/niceforms.js"></script>
  61.  
  62. </style>
  63.  
  64. </head>
  65. <body>
  66. <!-- The contact form starts here-->
  67. <?php
  68.    if ($_SERVER['REQUEST_METHOD'] != 'POST'){
  69.       $self = $_SERVER['PHP_SELF'];
  70. ?>
  71. <script type="text/javascript">
  72. try {
  73. var pageTracker = _gat._getTracker("UA-15164317-2");
  74. pageTracker._trackPageview();
  75. } catch(err) {}</script>
  76.  
  77.  
  78. <title>DISEÑO WEB- GráfIco- Editorial .</title>
  79. <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
  80. <script type="text/javascript">
  81. function MM_CheckFlashVersion(reqVerStr,msg){
  82.   with(navigator){
  83.     var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
  84.     var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
  85.     if (!isIE || !isWin){  
  86.       var flashVer = -1;
  87.       if (plugins && plugins.length > 0){
  88.         var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
  89.         desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
  90.         if (desc == "") flashVer = -1;
  91.         else{
  92.           var descArr = desc.split(" ");
  93.           var tempArrMajor = descArr[2].split(".");
  94.           var verMajor = tempArrMajor[0];
  95.           var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
  96.           var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
  97.           flashVer =  parseFloat(verMajor + "." + verMinor);
  98.         }
  99.       }
  100.       // WebTV has Flash Player 4 or lower -- too low for video
  101.       else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;
  102.  
  103.       var verArr = reqVerStr.split(",");
  104.       var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  105.  
  106.       if (flashVer < reqVer){
  107.         if (confirm(msg))
  108.           window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
  109.       }
  110.     }
  111.   }
  112. }
  113. </script>
  114.  
  115.  
  116. </head>
  117.  
  118. <body onload="MM_CheckFlashVersion('8,0,0,0','El contenido de la página requiere una nueva versión del reproductor Adobe Flash.  Desea descargarlo ahora?');">
  119.  
  120. <div class="contenedor">
  121.   <div id="frase">“La creatividad no consiste en hacer cosas nuevas, sino en hacerlas
  122. como si nunca hubiesen sido hechas por otros.”</div>
  123.  
  124.     <!-- inicio info -->
  125.   <div class="inf_tlf">
  126.          <div id="tlf">954 369 330</div>
  127.         <div id="icono-tlf"></div>
  128.         <div id="tlf"><a href="mailto:[email protected]">[email protected]</a></div>
  129.     <div id="icono-email"></div>
  130.     <!-- info tlf -->
  131.   </div>
  132.    
  133.    
  134.     <div class="cabecera">
  135.     <!-- BOTONERA Y LOGO -->
  136.  
  137.    <div class="logo"><img src="img/logo1.png" /></div>
  138.     <div id="botonera">
  139.          <ul>
  140.         <li><a id='enlace-inicio' href='/'>Inicio</a>
  141.         <li><a id='enlace-quienes-somos' href='/quienes.html'>¿Quiénes somos?</a>
  142.         <li><a id='enlace-clientes' href='/clientes.html'>Clientes</a>
  143.         <li><a id='enlace-localizacion' href='/localizacion'>Localización</a>        
  144.         <li><a id='enlace-contactar' href='/contacto.html'>Contactar</a>
  145.  
  146.     </ul>
  147.     </div>
  148.    <!-- FIN BOTONERA Y LOGO -->
  149.     </div>
  150.    
  151.       <!-- CABECERA CENTRAL -->
  152.      
  153.       <div class="contenedor-subseccion">
  154.        
  155.         <!-- COLUMNA 1 -->
  156.  
  157.     <div class="columna-izquierda_1">
  158.         <h1>Formulario De Contacto</h1>
  159.            
  160.                        
  161.             <form id="contenedor-formulario" enctype="multipart/form-data" method="post" target="_self">
  162.                 <input type="hidden" value="1" id="enviado" name="enviado" />
  163.                 <table width="590" border="0" cellpadding="0" cellspacing="0" id="tabla-formulario-1">
  164.  
  165.                   <tr><td width="226"><label><span class="texto-verde">Nombre</span>
  166.                   <input id="input-nombre" name="nombre" type="text"   /></label></td>
  167.  
  168.                                    
  169.                   <td width="50">&nbsp;</td>
  170. <td width="202"><label><span class="texto-verde">Apellidos</span>
  171.                     <input id="input-apellidos" name="apellidos" type="text"  />
  172.                   </label></td>
  173.                   </tr>
  174.                                    
  175.                   <tr><td><label><span class="texto-verde">Teléfono</span>
  176.                   <input id="input-telefono" name="telefono" type="text"   /></label></td>
  177.                  
  178.                   <td>&nbsp;</td>
  179.                   <td><label class="texto-verde"><span class="input-titulo">Email</span>
  180.                     <input id="input-email" name="email" type="text"   />
  181.                   </label></td>
  182.                   </tr>
  183.                 </table>
  184. <table width="542" border="0" cellpadding="0" cellspacing="0">
  185.                   <tr><td width="542"><label><span class="texto-verde">Asunto</span>
  186.                         <input type="asunto" value="" name="asunto" id="input-asunto">
  187.  
  188. <input type="hidden" name="asunto-h" value="Necesito presupuesto para flyers" /></label></td></tr>
  189.                   <tr><td><label><span class="texto-verde">Mensaje</span>
  190.                   <textarea name="message" rows="12"  id="input-mensaje"></textarea></label></td></tr>
  191.                 </table>
  192.                 <button type="submit">Enviar Consulta</button>
  193.             </form>
  194.     </div>
  195.     <div class="ancho-columna-3">
  196.             <h1 id="rotulo-contacto">Contacto</h1>
  197.             <p class="Estilo3">Puede escribirnos un email directo utilizando la siguiente dirección:</p>
  198.           <p><a href="mailto:[email protected]" class="texto-verde email-a">[email protected]</a>         </p>
  199.             <p>&nbsp;</p>
  200.             <p class="Estilo3">Si quiere hablar con nosotros, vía telefónica, dispone de un formulario por el cual le llamaremos nosotros de manera gratuita y en menos de 24 horas.</p>
  201.             <p>&nbsp;</p>
  202.             <a href="/contactar/te-llamamos" class="texto-verde email-a Estilo4">Formulario “Te llamamos”</a>            
  203.             <p class="Estilo3">En caso de que tenga mayor urgencia en contactar con nosotros disponemos de una linea de atención al cliente:</p>
  204.  
  205.             <p class="Estilo3"><strong>Teléfono:</strong> 955 412 011</p>
  206.             <p class="contactar-telefono">&nbsp;</p>
  207.             <h1 id="rotulo-localizacion">Localización</h1>
  208.             <p class="alto-linea-1 Estilo3">Plaza Ruiz de Alda (Sevilla)<br />
  209.                Nº 1 Centro de Negocios.<br />
  210.                Planta 5 Módulo 4.<br />
  211.  
  212.                41015 Sevilla</p>
  213.             <a href="/localizacion" class="texto-verde mapa-a">Ver mapa de localización</a>        </div>
  214.     <?php
  215.     } else {
  216.         error_reporting(0);
  217.  
  218.         if  (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))
  219.  
  220.         //Message sent!
  221.         //It the message that will be displayed when the user click the sumbit button
  222.         //You can modify the text if you want
  223.         echo nl2br("
  224.         <div class=\"MsgSent\">
  225.             <h1>Correcto</h1>
  226.             <p>Su mensaje <b><?=$name;?></b>, se ha enviado correctamente!<br /> En 24H nos pondremos en contacto con unsted.</p>
  227.         </div>
  228.        ");
  229.  
  230.         else
  231.  
  232.         // Display error message if the message failed to send
  233.         echo "
  234.         <div class=\"MsgError\">
  235.             <h1>Error!!</h1>
  236.             <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p>
  237.         </div>";
  238.     }
  239.  
  240. ?>
  #4 (permalink)  
Antiguo 13/10/2010, 00:31
 
Fecha de Ingreso: febrero-2007
Mensajes: 18
Antigüedad: 17 años, 2 meses
Puntos: 2
Respuesta: quien me solucina este problema

En la línea 224, donde tenés ....
Código PHP:
Ver original
  1. <div class=\"MsgSent\">
  2.           echo nl2br("
  3.         <div class=\"MsgSent\">
  4.             <h1>Correcto</h1>
  5.             <p>Su mensaje <b><?=$name;?></b>, se ha enviado correctamente!<br /> En 24H nos pondremos en contacto con unsted.</p>
  6.         </div>
  7.        ");

Cambialo por
Código PHP:
Ver original
  1. echo nl2br("
  2.    
  3. <script type=\"text/javascript\">
  4. <!--
  5. window.location = \"http://www.google.com/\"
  6. //-->
  7. </script>
  8.       ");

Acá solo podés redireccionar con Javascript ya que el código PHP está al final del archivo (cuando ya se enviaron las cabeceras). Si pudieras cambiar el código de lugar y ponerlo antes, podés redireccionar con
Código PHP:
Ver original
  1. header("Location: http://www.google.com");


Cambiando la dirección por la que te corresponde.

saludos
  #5 (permalink)  
Antiguo 13/10/2010, 04:49
Avatar de orllo55  
Fecha de Ingreso: junio-2006
Mensajes: 44
Antigüedad: 17 años, 10 meses
Puntos: 0
Respuesta: quien me solucina este problema

Buenas lo he provado pero que va no me redirecciona a ningun sitio, gracias de todos modos, seguire intentandolo!!! saludos

Etiquetas: Ninguno
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 04:52.