Ade FX Posted September 6, 2005 Share Posted September 6, 2005 I am having problems with my contact script. I send the form and it comes up with this error: Warning: Cannot modify header information - headers already sent by (output started at /files/home1/smjfreeman/apollo/contact.php:5) in /files/home1/smjfreeman/apollo/contact.php on line 65 Here is the code: <html><head><title>Apollo IT - Contact</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"><!--.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; }--></style></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><!-- ImageReady Slices (design.jpg) --><br><table width="600" height="401" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"><tr> <td height="24" colspan="9"> <img src="images/designimage_01.jpg" width="600" height="24" alt=""></td></tr><tr> <td height="99" colspan="9"> <img src="images/designimage_02.jpg" width="600" height="99" alt=""></td></tr><tr> <td height="32" colspan="2"> <img src="images/designimage_03.jpg" width="210" height="32" alt=""></td> <td height="32"> <a href="http://www.apolloit.co.uk/index.htm"><img src="images/designimage_04.jpg" alt="" width="53" height="32" border="0"></a></td> <td height="32"> <a href="http://www.apolloit.co.uk/products.htm"><img src="images/designimage_05.jpg" alt="" width="75" height="32" border="0"></a></td> <td height="32"> <a href="http://www.apolloit.co.uk/services.htm"><img src="images/designimage_06.jpg" alt="" width="74" height="32" border="0"></a></td> <td height="32"> <a href="http://www.apolloit.co.uk/about.htm"><img src="images/designimage_07.jpg" alt="" width="56" height="32" border="0"></a></td> <td height="32"> <a href="http://cgi.smjfreeman.plus.com/apollo/contact.php"><img src="images/designimage_08.jpg" alt="" width="68" height="32" border="0"></a></td> <td colspan="2"> <img src="images/designimage_09.jpg" width="64" height="32" alt=""></td></tr><tr> <td height="20" colspan="9"> <img src="images/designimage_10.jpg" width="600" height="20" alt=""></td></tr><tr> <td background="images/designimage_11.jpg"> </td> <td colspan="7"> <div align="center"><?$name = $HTTP_POST_VARS['name'];$message = $HTTP_POST_VARS['message'];$email = $HTTP_POST_VARS['email'];$type = $HTTP_POST_VARS['type'];$subj= $HTTP_POST_VARS['subject'];if ($type == "mail") { $to = "[email protected]"; $msg = "Message sent by $name from mailer form\n\n"; $msg .= "$message\n\n"; $subject = "$subj"; mail($to, $subject, $msg, "From: $email\n"); header( "Location: http://www.apolloit.co.uk/sent.htm" ); exit (); } ?></span><form action="<?= $PHP_SELF ?>" method="post" name="form1" class="style1"><br><table width="22%" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td align="right" valign="top" nowrap class="style1"><div align="center" class="style3">Name:<br> <input name="name" type="text" id="name" size="45"> </div></td> </tr> <tr> <td align="right" valign="top" nowrap class="style1"><div align="center" class="style3">E-mail address:<br> <input name="email" type="text" id="email" size="45"> </div></td> </tr> <tr> <td align="right" valign="top" nowrap class="style1"><div align="center" class="style3">Subject:<br> <input name="subject" type="text" id="subject" size="45"> </div></td> </tr> <tr> <td align="right" valign="top" nowrap class="style1"><div align="center" class="style3">Message:<br> <textarea name="message" cols="40" rows="10" id="message"></textarea> <input name="type" type="hidden" value="mail"> </div></td> </tr> <tr> <td align="right" valign="top" nowrap><div align="center"> <input name="submit" type="submit" value="Submit"> <input name="reset" type="reset" value="Reset"> </div></td> </tr> </table> </form></div></td> <td background="images/designimage_13.jpg"> </td></tr><tr> <td height="27" colspan="9"> <img src="images/designimage_14.jpg" width="600" height="27" alt=""></td></tr><tr> <td height="24" colspan="9"> <img src="images/designimage_15.jpg" width="600" height="24" alt=""></td></tr><tr> <td> <img src="images/spacer.gif" width="24" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="186" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="53" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="75" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="74" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="56" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="68" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="38" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="26" height="1" alt=""></td></tr></table><!-- End ImageReady Slices --><p align="center"><IFRAME border=0 name=I1 src="http://cgi.smjfreeman.plus.com/apollo/apollostatus.php" frameBorder=0 WIDTH=400 HEIGHT=30 target="_blank" marginheight="0" marginwidth="0"> </IFRAME></p></body></html> Thanks in advance Link to comment Share on other sites More sharing options...
segosa Posted September 6, 2005 Share Posted September 6, 2005 It's exactly what it says.. you can't modify the header info ("Location:" is a header) when data has already been sent. To solve it, try copying this: <?$name = $HTTP_POST_VARS['name'];$message = $HTTP_POST_VARS['message'];$email = $HTTP_POST_VARS['email'];$type = $HTTP_POST_VARS['type'];$subj= $HTTP_POST_VARS['subject'];if ($type == "mail") { $to = "[email protected]"; $msg = "Message sent by $name from mailer form\n\n"; $msg .= "$message\n\n"; $subject = "$subj";mail($to, $subject, $msg, "From: $email\n");header( "Location: http://www.apolloit.co.uk/sent.htm" );exit ();} to the top of the file, before anything else. Link to comment Share on other sites More sharing options...
Ade FX Posted September 6, 2005 Author Share Posted September 6, 2005 ah it works! Thank you! This can be locked now. Link to comment Share on other sites More sharing options...
segosa Posted September 6, 2005 Share Posted September 6, 2005 This can be locked now. Why? Someone might see the topic and have something to add. Or you might have another problem which you could use this thread for instead of making a new one... what's the point in locking. Link to comment Share on other sites More sharing options...
PSXtreme Posted September 8, 2005 Share Posted September 8, 2005 <td> <img src="images/spacer.gif" width="24" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="186" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="53" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="75" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="74" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="56" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="68" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="38" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="26" height="1" alt=""></td></tr> You probably should lock it, because if Cerbera sees this, he'll have a heart attack. Link to comment Share on other sites More sharing options...
Ade FX Posted September 8, 2005 Author Share Posted September 8, 2005 I didn't do that, it came from photoshop Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now