shoyle Posted July 27, 2009 Share Posted July 27, 2009 Hi, I allways receive good answers from this forum so I hope it happens again so after the thanks to all the ones who spend time helping dummies like me, i got this cuestion: I got this html contact page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="shortcut icon" href="http://www.laradialautomoviles.com/favicon.gif"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>.: La Radial Automoviles - Contacto :.</title><style type="text/css"><!--body { background-image: url(images/rayas.gif); background-color: #FFFFFF;}.Estilo13 {font-family: Calibri; color: #333333; }.Estilo7 {font-family: Calibri; color: #FFFFFF; }.Estilo11 { color: #27A7E4; font-weight: bold; font-family: Calibri; font-size: 24px;}a:link { color: #15BCFB; text-decoration: none;}a:visited { color: #0679B0; text-decoration: none;}a:hover { color: #2495F0; text-decoration: none;}a:active { color: #666666; text-decoration: none;}.Estilo20 {font-family: Calibri; color: #FFFFFF; font-weight: bold; }.Estilo21 {font-family: Calibri}.Estilo22 {color: #FFFFFF}--></style><script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script><script type="text/javascript"><!--function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}//--></script></head><body onload="MM_preloadImages('images/larradial_08.gif','images/larradial_09.gif','images/larradial_10.gif','images/larradial_11.gif','images/larradial_12.gif','images/la-BUENA-2_06.gif','images/la-BUENA-2_07.gif','images/la-BUENA-2_08.gif','images/la-BUENA-2_09.gif','images/la-BUENA-2_10.gif')" topmargin="0"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0" background="images/rayas.gif"> <tr> <td height="89"><img src="images/la-BUENA_03.gif" width="763" height="196" /></td> </tr> <tr> <td height="272"><script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','763','height','272','src','slide','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','slide' ); //end AC code</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="763" height="272"> <param name="movie" value="slide.swf" /> <param name="quality" value="high" /> <embed src="slide.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="763" height="272"></embed> </object></noscript></td> </tr> <tr> <td height="37"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/la-BUENA-2_06.gif',1)"><img src="images/la-BUENA_06.gif" name="Image2" width="101" height="72" border="0" id="Image2" /></a><a href="vehiculos-nuevos.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/la-BUENA-2_07.gif',1)"><img src="images/la-BUENA_07.gif" name="Image3" width="192" height="72" border="0" id="Image3" /></a><a href="vehiculos-usados.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/la-BUENA-2_08.gif',1)"><img src="images/la-BUENA_08.gif" name="Image4" width="180" height="72" border="0" id="Image4" /></a><a href="nuestro-equipo.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/la-BUENA-2_09.gif',1)"><img src="images/la-BUENA_09.gif" name="Image5" width="171" height="72" border="0" id="Image5" /></a><a href="contacto.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/la-BUENA-2_10.gif',1)"><img src="images/la-BUENA_10.gif" name="Image6" width="119" height="72" border="0" id="Image6" /></a></td> </tr> <tr><td height="500" background="images/bak.gif"><table width="762" height="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td><table width="100" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> <tr> <td><form action="enviar.php" method="post"><div align="center"><span class="Estilo21">Nombre:</span><br/> <input type="text" name="nombre" /> <br/> <br/><span class="Estilo21">Teléfono:</span><br/><input type="text" name="telefono" /><br/><br/><span class="Estilo21">E-mail:</span><br/><input type="text" name="email" /><br/><br/><span class="Estilo21">Mensaje:</span><br/><textarea rows="10" cols="50" name="mensaje"></textarea><br/><br/><input type="image" name="submit" src="images/enviar.gif" border="0" /> <!-- este codigo te puede servir <input type="image" name="submit" src="submit.png" border="0" /> en caso de kerer usar una imagen diferente para el boton d enviar --></div></td></tr> </table></td> </tr> </table></td> </tr> <tr><td height="62"><a href="http://www.mysite.com"><img src="images/la-BUENA_13.gif" width="763" height="62" border="0"/></a></td> </tr></table></body></html> and this php: <?php//aca va el link a la pagina d gracias:Dheader( 'Location: [url="http://www.laradialautomoviles.com/gracias.html'"]http://www.laradialautomoviles.com/gracias.html'[/url] ) ;$nombre = $_POST['nombre'];$telefono = $_POST['telefono'];$mail = $_POST['email'];//------------------------------------------------------//if(!$mail == "" && (!strstr($mail,"@") || !strstr($mail,"."))){echo "<h2>Vuelva a la pagina anterior, ingrese una direccion de e-mail válida-.</h2>\n";$badinput = "<h2>La informacion no fue ingresada.</h2>\n";echo $badinput;die ("Vuelva a la pagina anterior.");}//aca creo 1q dice: si los campos: visitante, mail de visitante, y nota estan vacios el resultado es: vuelva atraz rellene los campos vacios :)if(empty($nombre) || empty($telefono) || empty($mail)) {echo "<h2>Vuelva a la pagina anterior, rellene todas las casillas.</h2>\n";die ("Vuelva a la pagina anterior.");}$pattern = '/[^0-9]/';if (preg_match($pattern, $telefono)) {echo "<h2>Vuelva a la pagina anterior, ingrese un numero de telefono valido.</h2>\n";die ("Vuelva a la pagina anterior."); // $telefono contains invalid characters}if (empty($POST['mensaje'])) {echo "<h2>Vuelva a la pagina anterior, rellene todas las casillas.</h2>\n";die ("Vuelva a la pagina anterior."); // the user left the element empty}//--------------------------------------------------------------------------//$header = 'From: ' . $mail . " rn";$mensaje = "Este mensaje fue enviado por " . $nombre . " ";$mensaje .= "Su telefono es: " . $telefono . " ";$mensaje .= "Su e-mail es: " . $mail . " ";$mensaje .= "Mensaje: " . $_POST['mensaje'] . " " ;$mensaje .= "Enviado el " . date('d/m/Y', time());//-----------------------------------------------------////----------------------------------------------------//$para = 'admin@pumsho.com';$asunto = 'Contacto desde pagina web';mail($para, $asunto, utf8_decode($mensaje), $header);echo 'Su mensaje ha sido enviado correctamente.';?> now what I want is to have the php results displayed in an html similar to the one on top, so when they insert the write word to have a : thank you your mesage was sent, and when they do wrong: please fill all the information correctly , or something like that.. I'll be really thankfull!!!! Link to comment Share on other sites More sharing options...
Synook Posted July 27, 2009 Share Posted July 27, 2009 Just echo the HTML, like you already have done for the other bits. echo '<p>Su mensaje ha sido enviado correctamente.</p>'; Link to comment Share on other sites More sharing options...
shoyle Posted July 27, 2009 Author Share Posted July 27, 2009 Just echo the HTML, like you already have done for the other bits.echo '<p>Su mensaje ha sido enviado correctamente.</p>'; how would tht be? sorry im begeiner on php you mean something like: echo '<a href="http://www.mysite.com/thankyou.html"></a>' ??????? Link to comment Share on other sites More sharing options...
huw008 Posted July 27, 2009 Share Posted July 27, 2009 You could just add a backslash before each quote. <a href=\"http://www.mysite.com/thankyou.html\">MySite</a> Link to comment Share on other sites More sharing options...
gekk0 Posted July 28, 2009 Share Posted July 28, 2009 you could also just "break" the php code up when putting just plain html into the script,like so <?php//Your php code here$someVar = 'Hello World!';?><b>Some html here</b><i>And now i echo print a variable.....<? echo $someVar; ?></i><?//More php code here?> this is usefull if you have a lot of html to send, and putting backslashes all the way through would be tidious. Link to comment Share on other sites More sharing options...
dsonesuk Posted July 28, 2009 Share Posted July 28, 2009 is this still valid? used this ages ago, and it still works.<body><?php$inserttext = "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex.";print <<<END<p style="color: lime;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. <span style="color: red;">$inserttext</span> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex. </p>END;?></body> Link to comment Share on other sites More sharing options...
boen_robot Posted July 28, 2009 Share Posted July 28, 2009 is this still valid? used this ages ago, and it still works.<body><?php$inserttext = "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex.";print <<<END<p style="color: lime;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. <span style="color: red;">$inserttext</span> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex. </p>END;?></body>Yes. It's a syntax known as "heredoc", and it has been valid for a long time, and still is. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 28, 2009 Share Posted July 28, 2009 There's a new format called nowdoc also (as of PHP 5.3), a nowdoc is to a single-quoted string as a heredoc is to a double-quoted string. Link to comment Share on other sites More sharing options...
shoyle Posted August 11, 2009 Author Share Posted August 11, 2009 mmm im a bit confused, im very new on php so if any of you can show me your examples inside my php i be very greatfull, ive tryied mixing php with html but it doesnt seem to workthanks a lot Link to comment Share on other sites More sharing options...
Ingolme Posted August 11, 2009 Share Posted August 11, 2009 You cannot output anything before using the header() or setcookie() functions, or anything else that sends headers to the client.In the first PHP code you showed, the header() function will redirect to another page, and everything after it will be ignored. Link to comment Share on other sites More sharing options...
shoyle Posted August 12, 2009 Author Share Posted August 12, 2009 I understand what youre saying, still I cant find the way to make it work as i want, is it possible to put like sopose: if(empty($nombre) || empty($telefono) || empty($mail)) {echo "<a href="mysite.com/fill-all-fields.html></a>";die (<a href="mysite.com/fill-all-fields.html></a>);}$pattern = '/[^0-9]/';if (preg_match($pattern, $telefono)) {echo <a href="mysite.com/wrong-phone-number.html></a>;die (<a href="mysite.com/wrong-phone-number.html></a>);} is somthing like this possible? like instead of displaying the results in the same type of page, have a page for each type of error, how can I do that ? thx!!! Link to comment Share on other sites More sharing options...
Ingolme Posted August 12, 2009 Share Posted August 12, 2009 I understand what youre saying, still I cant find the way to make it work as i want, is it possible to put like sopose: if(empty($nombre) || empty($telefono) || empty($mail)) {echo "<a href="mysite.com/fill-all-fields.html></a>";die (<a href="mysite.com/fill-all-fields.html></a>);}$pattern = '/[^0-9]/';if (preg_match($pattern, $telefono)) {echo <a href="mysite.com/wrong-phone-number.html></a>;die (<a href="mysite.com/wrong-phone-number.html></a>);} is somthing like this possible? like instead of displaying the results in the same type of page, have a page for each type of error, how can I do that ? thx!!!That code wouldn't do anything. And if you echo a link, all that will appear on the page is a link. If the link has no text in it, it will be invisible.The way to redirect is to use the header() function:if(empty($nombre) || empty($telefono) || empty($mail)) { header("Location: mysite.com/fill-all-fields.html");} There is no need to echo anything before or after a header() function because the moment header() is called, the page is redirected and there is not even time to see anything that was written with echo.(This is in the hypothetical case that PHP didn't throw an error when attempting to output before sending a header) Link to comment Share on other sites More sharing options...
shoyle Posted August 13, 2009 Author Share Posted August 13, 2009 So this means that to each different error I can put a diferent header() ? so I have a different page for each tipe of error? Link to comment Share on other sites More sharing options...
Synook Posted August 13, 2009 Share Posted August 13, 2009 If you want, yes. But it would probably be easier just to have one error page that you pass the error text to. if(empty($nombre) || empty($telefono) || empty($mail)) { header("Location:error.php?error=fill-all-fields");} Link to comment Share on other sites More sharing options...
shoyle Posted August 13, 2009 Author Share Posted August 13, 2009 mmm yup but i want it to allways have the results on a html, so scince I dont know how to get the results inside the same html I will make an html for each error, do I just put header under each error with the different htmls? Wish I could hace contact form and php results on the page of the contact form but scince I dont know how and havent find how to on the web I gess ill do it this way :S Link to comment Share on other sites More sharing options...
Synook Posted August 13, 2009 Share Posted August 13, 2009 You can still have the results displayed in HTML with the querystring method. In fact using that method you can have the error results shown on the same page, using a lookback reference: if(empty($nombre) || empty($telefono) || empty($mail)) { header("Location:the-current-page.php?error=fill-all-fields");} Then on that page, under/over the form: <?php if (isset($_GET['error'])) { ?><p class="error"><?phpif ($_GET['error'] == "fill-all-fields") { echo "Please fill all fields.";}?></p><?php } ?> Link to comment Share on other sites More sharing options...
shoyle Posted August 13, 2009 Author Share Posted August 13, 2009 but, everytime ive put the php inside the html the computer reads first the php and then the html so i get the "fill all fields" error when I enter the contact page, now, the code you are giving me how do I mix it with my php and html? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 13, 2009 Share Posted August 13, 2009 Check this thread, there are examples of using a PHP script to both display and process the same form, do error handling, etc. You should be doing all of this on one PHP page.http://w3schools.invisionzone.com/index.php?showtopic=12509 Link to comment Share on other sites More sharing options...
dsonesuk Posted August 13, 2009 Share Posted August 13, 2009 similar to this:thisphpform.php<?php$nombre = "";$telefono ="";$email = "";$mensaje = "";$errormsg = "";if (isset($_POST['nombre']) || isset($_POST['telefono']) || isset($_POST['email'])) { $nombre = $_POST['nombre']; $telefono = $_POST['telefono']; $email = $_POST['email']; $mensaje = $_POST['mensaje']; if(empty($nombre) || empty($telefono) || empty($email)) { $errormsg.= "<p style=\"color: red;\">Please Fill In Empty Fields.</p>"; } $pattern = '/[^0-9]/'; if (preg_match($pattern, $telefono)) { $errormsg.= "<p style=\"color: red;\">Invalid Telephone Number entered.</p>"; } if($errormsg == "") { header("Location: http://www.laradialautomoviles.com/gracias.html"); }}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="shortcut icon" href="http://www.laradialautomoviles.com/favicon.gif"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>.: La Radial Automoviles - Contacto :.</title><style type="text/css"><!--body {background-image: url(images/rayas.gif);background-color: #FFFFFF;}.Estilo13 {font-family: Calibri; color: #333333; }.Estilo7 {font-family: Calibri; color: #FFFFFF; }.Estilo11 {color: #27A7E4;font-weight: bold;font-family: Calibri;font-size: 24px;}a:link {color: #15BCFB;text-decoration: none;}a:visited {color: #0679B0;text-decoration: none;}a:hover {color: #2495F0;text-decoration: none;}a:active {color: #666666;text-decoration: none;}.Estilo20 {font-family: Calibri; color: #FFFFFF; font-weight: bold; }.Estilo21 {font-family: Calibri}.Estilo22 {color: #FFFFFF}--></style><script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script><script type="text/javascript"><!--function MM_findObj(n, d) { //v4.01var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_preloadImages() { //v3.0var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}}function MM_swapImgRestore() { //v3.0var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;}function MM_swapImage() { //v3.0var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}//--></script></head><body onload="MM_preloadImages('images/larradial_08.gif','images/larradial_09.gif','images/larradial_10.gif','images/larradial_11.gif','images/larradial_12.gif','images/la-BUENA-2_06.gif','images/la-BUENA-2_07.gif','images/la-BUENA-2_08.gif','images/la-BUENA-2_09.gif','images/la-BUENA-2_10.gif')" topmargin="0"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0" background="images/rayas.gif"><tr><td height="89"><img src="images/la-BUENA_03.gif" width="763" height="196" /></td></tr><tr><td height="272"><script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','763','height','272','src','slide','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','slide' ); //end AC code</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="763" height="272"><param name="movie" value="slide.swf" /><param name="quality" value="high" /><embed src="slide.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="763" height="272"></embed></object></noscript></td></tr><tr><td height="37"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/la-BUENA-2_06.gif',1)"><img src="images/la-BUENA_06.gif" name="Image2" width="101" height="72" border="0" id="Image2" /></a><a href="vehiculos-nuevos.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/la-BUENA-2_07.gif',1)"><img src="images/la-BUENA_07.gif" name="Image3" width="192" height="72" border="0" id="Image3" /></a><a href="vehiculos-usados.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/la-BUENA-2_08.gif',1)"><img src="images/la-BUENA_08.gif" name="Image4" width="180" height="72" border="0" id="Image4" /></a><a href="nuestro-equipo.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/la-BUENA-2_09.gif',1)"><img src="images/la-BUENA_09.gif" name="Image5" width="171" height="72" border="0" id="Image5" /></a><a href="contacto.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/la-BUENA-2_10.gif',1)"><img src="images/la-BUENA_10.gif" name="Image6" width="119" height="72" border="0" id="Image6" /></a></td></tr><tr><td height="500" background="images/bak.gif"><table width="762" height="500" border="0" cellpadding="0" cellspacing="0"><tr><td><table width="100" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td> </td></tr><tr><td><?php echo $errormsg; ?><form action="thisphpform.php" method="post" target="_self"><div align="center"><span class="Estilo21">Nombre:</span><br/><input type="text" name="nombre" value="<?php echo $nombre ?>" /><br/><br/><span class="Estilo21">Teléfono:</span><br/><input type="text" name="telefono" value="<?php echo $telefono ?>" /><br/><br/><span class="Estilo21">E-mail:</span><br/><input type="text" name="email" value="<?php echo $email ?>" /><br/><br/><span class="Estilo21">Mensaje:</span><br/><textarea rows="10" cols="50" name="mensaje"><?php echo $mensaje ?></textarea><br/><br/><input type="image" name="submit" src="images/enviar.gif" border="0" /> </div></form></td></tr></table></td></tr></table></td></tr><tr><td height="62"><a href="http://www.mysite.com"><img src="images/la-BUENA_13.gif" width="763" height="62" border="0"/></a></td></tr></table></body></html> Link to comment Share on other sites More sharing options...
shoyle Posted August 15, 2009 Author Share Posted August 15, 2009 similar to this:thisphpform.php<?php$nombre = "";$telefono ="";$email = "";$mensaje = "";$errormsg = "";if (isset($_POST['nombre']) || isset($_POST['telefono']) || isset($_POST['email'])) { $nombre = $_POST['nombre']; $telefono = $_POST['telefono']; $email = $_POST['email']; $mensaje = $_POST['mensaje']; if(empty($nombre) || empty($telefono) || empty($email)) { $errormsg.= "<p style=\"color: red;\">Please Fill In Empty Fields.</p>"; } $pattern = '/[^0-9]/'; if (preg_match($pattern, $telefono)) { $errormsg.= "<p style=\"color: red;\">Invalid Telephone Number entered.</p>"; } if($errormsg == "") { header("Location: http://www.laradialautomoviles.com/gracias.html"); }}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="shortcut icon" href="http://www.laradialautomoviles.com/favicon.gif"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>.: La Radial Automoviles - Contacto :.</title><style type="text/css"><!--body {background-image: url(images/rayas.gif);background-color: #FFFFFF;}.Estilo13 {font-family: Calibri; color: #333333; }.Estilo7 {font-family: Calibri; color: #FFFFFF; }.Estilo11 {color: #27A7E4;font-weight: bold;font-family: Calibri;font-size: 24px;}a:link {color: #15BCFB;text-decoration: none;}a:visited {color: #0679B0;text-decoration: none;}a:hover {color: #2495F0;text-decoration: none;}a:active {color: #666666;text-decoration: none;}.Estilo20 {font-family: Calibri; color: #FFFFFF; font-weight: bold; }.Estilo21 {font-family: Calibri}.Estilo22 {color: #FFFFFF}--></style><script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script><script type="text/javascript"><!--function MM_findObj(n, d) { //v4.01var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_preloadImages() { //v3.0var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}}function MM_swapImgRestore() { //v3.0var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;}function MM_swapImage() { //v3.0var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}//--></script></head><body onload="MM_preloadImages('images/larradial_08.gif','images/larradial_09.gif','images/larradial_10.gif','images/larradial_11.gif','images/larradial_12.gif','images/la-BUENA-2_06.gif','images/la-BUENA-2_07.gif','images/la-BUENA-2_08.gif','images/la-BUENA-2_09.gif','images/la-BUENA-2_10.gif')" topmargin="0"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0" background="images/rayas.gif"><tr><td height="89"><img src="images/la-BUENA_03.gif" width="763" height="196" /></td></tr><tr><td height="272"><script type="text/javascript">AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','763','height','272','src','slide','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','slide' ); //end AC code</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="763" height="272"><param name="movie" value="slide.swf" /><param name="quality" value="high" /><embed src="slide.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="763" height="272"></embed></object></noscript></td></tr><tr><td height="37"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/la-BUENA-2_06.gif',1)"><img src="images/la-BUENA_06.gif" name="Image2" width="101" height="72" border="0" id="Image2" /></a><a href="vehiculos-nuevos.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/la-BUENA-2_07.gif',1)"><img src="images/la-BUENA_07.gif" name="Image3" width="192" height="72" border="0" id="Image3" /></a><a href="vehiculos-usados.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/la-BUENA-2_08.gif',1)"><img src="images/la-BUENA_08.gif" name="Image4" width="180" height="72" border="0" id="Image4" /></a><a href="nuestro-equipo.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/la-BUENA-2_09.gif',1)"><img src="images/la-BUENA_09.gif" name="Image5" width="171" height="72" border="0" id="Image5" /></a><a href="contacto.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/la-BUENA-2_10.gif',1)"><img src="images/la-BUENA_10.gif" name="Image6" width="119" height="72" border="0" id="Image6" /></a></td></tr><tr><td height="500" background="images/bak.gif"><table width="762" height="500" border="0" cellpadding="0" cellspacing="0"><tr><td><table width="100" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td> </td></tr><tr><td><?php echo $errormsg; ?><form action="thisphpform.php" method="post" target="_self"><div align="center"><span class="Estilo21">Nombre:</span><br/><input type="text" name="nombre" value="<?php echo $nombre ?>" /><br/><br/><span class="Estilo21">Teléfono:</span><br/><input type="text" name="telefono" value="<?php echo $telefono ?>" /><br/><br/><span class="Estilo21">E-mail:</span><br/><input type="text" name="email" value="<?php echo $email ?>" /><br/><br/><span class="Estilo21">Mensaje:</span><br/><textarea rows="10" cols="50" name="mensaje"><?php echo $mensaje ?></textarea><br/><br/><input type="image" name="submit" src="images/enviar.gif" border="0" /> </div></form></td></tr></table></td></tr></table></td></tr><tr><td height="62"><a href="http://www.mysite.com"><img src="images/la-BUENA_13.gif" width="763" height="62" border="0"/></a></td></tr></table></body></html> it doesnt work, when I preview it in mozilla I can see all the php in different parts of the page :S Link to comment Share on other sites More sharing options...
dsonesuk Posted August 15, 2009 Share Posted August 15, 2009 Strange? this works fine on my php server.did you save as php file 'thisphpform.php' ? does the server use php? or asp? scriptingsave this as test.php<html><head</head><body><?php echo "hello world";?></body></html>if you see 'hello world' without quotes php scripting is useif you see:<?php echo "hello world";?>then the server is not using php, or it is not configured correctly?. Link to comment Share on other sites More sharing options...
shoyle Posted August 18, 2009 Author Share Posted August 18, 2009 I tryied it in e explorer and same, doesnt work :s Link to comment Share on other sites More sharing options...
shoyle Posted August 18, 2009 Author Share Posted August 18, 2009 Never mind!!! it does work!!!!! I had a tiny mistake (accidentally deleted a <)It works well, now I had to add the part of "invalid e-mail adress" and so on and "you didnt submit any message" do I just paste it on the top where the php is?I also have to add the e-mail address ill be sent to, do i paste that part as well? lots of thx!!!!!!!!!!! Link to comment Share on other sites More sharing options...
dsonesuk Posted August 18, 2009 Share Posted August 18, 2009 add the validation rules for email, and message above:if($errormsg == "") { header("Location: http://www.laradialautomoviles.com/gracias.html"); }email?? depends on method you use, if there are no error messages it wil do the above, so you could add it above the header function i suppose, process email then go to specific page, don't know, try it out. Link to comment Share on other sites More sharing options...
shoyle Posted August 18, 2009 Author Share Posted August 18, 2009 I tryied the rules for mesage and e-mail, I tried the ones on my other php and tryed to make them similar to this oone but dont seeem to work Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.