QUOTE
Warning: Cannot modify header information - headers already sent by (output started at /home/epox/public_html/contacto.php:9) in /home/epox/public_html/contacto.php on line 13
if someone knows how to correct the error i will be so gratefuly.
|
|
|
QUOTE Warning: Cannot modify header information - headers already sent by (output started at /home/epox/public_html/contacto.php:9) in /home/epox/public_html/contacto.php on line 13 if someone knows how to correct the error i will be so gratefuly.
It be much easier for us to help you in this problem if you actually showed us the coding.
That error normally appears if you try to set a header after it has already been sent. Headers must be set before the script outputs anything to the browser or any action is taken like that. If you need to force another page, try using some simple javascript.
Moe php code before html tags <head> </head> starts. I guest this is can help but if not the code is very helpfull
-------------------- Practice is when evrything is work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why
The code header("Location: mysite.html"); MUST be put at the very beginning of your code...before headers are sent. That's basically all I can tell you without looking at the code.
You can also try my script: http://www.trap17.com/forums/email-script-...php-t20516.html this is the php code: CODE <?php $dbh=mysql_connect ("localhost", "epox", "******") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("epox_tribusuburbanas"); $nombre=$_GET['nombre']; $mail=$_GET['mail']; $movil=$_GET['movil']; $fijo=$_GET['fijo']; mysql_query("insert into agenda values ('$nombre','$mail','$movil','$fijo')",$dbh); header("agenda.htm"); ?> and here the htm: CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Agenda</title> <style type="text/css"> body{ margin-top: 20px; text-align: center; background-color: #666;} #container{ background-color: #3399FF; border: 1px solid #fff; margin-right: auto; margin-left: auto; padding: 0px 10px 10px 0px; width: 300px;} #header{ background-color:#FF9900;} #header h3{ margin: 0px; padding: 10px; font-size: 20px; color: #fff; font-weight: normal;} #form{ padding-left: 10px; padding-top: 10px; color: #CCCCCC; text-align: left;} </style> </head> <body> <div id="container"> <div id="header"><h3>Agenda</h3></div> <div id="form"> <form name="agenda" action="agenda.php"> <input type="text" name="nombre"> Nombre<br> <input type="text" name="mail"> eMail<br> <input type="text" name="movil"> Movil<br> <input type="text" name="fijo"> Fijo<br> <input type="submit" value="enviar"> </form> </div> </div> </body> </html> well that's all, thank you for any colaboration!
I do not mysql much but don't you have to close the connection with the database? Try putting mysql_close(); before the header command.
Also, I've just noticed, that that's not how you redirect someone with php. It should be: CODE header("location:agenda.htm"); Try these small changes and then see if it works QUOTE(epox @ Aug 3 2005, 05:52 PM) helloo!, here goes the code: this is the php code: CODE <?php $dbh=mysql_connect ("localhost", "epox", "******") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("epox_tribusuburbanas"); $nombre=$_GET['nombre']; $mail=$_GET['mail']; $movil=$_GET['movil']; $fijo=$_GET['fijo']; mysql_query("insert into agenda values ('$nombre','$mail','$movil','$fijo')",$dbh); header("agenda.htm"); ?> [...] Make sure you have NO whitespace before your <?php tag, as that whitespace will cause PHP to start outputting to the browser, which in turn causes the default headers to be sent... Also, you should specify the full URL to the file to redirect to.. This quote is from PHP.net on the subject: QUOTE(PHP.Net) Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself: CODE <?php header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . $relative_url); ?> I hope that helps!! |
|
![]() Php Redirectioning Trouble |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute more info. to help others. Ask your Doubts & Queries to get answers, So that "Together We can help others!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|