Click to See Complete Forum and Search --> : Hellpppppp AHHH
jamie007
12-28-2005, 07:32 PM
Hi everyone,
Im having a few problems with my site...im only 15 and do not have a clue about php scripting...so if you know a way to fix this please explain carefully :D:D lol sorry!
I have got a cpanel site. It is hosted with ZENwebhosting.com. With their cpanel they offer this service called Fantastico.
This has many different services attached to it for example, blogs, forums, chat and more.
one of the services is called phpFormGenerator, i am using this.
It is simple and easy to use as it does most of the work for you.
So i have set up my forms (3 in total) it saves them in the public html folder with the rest of the cotent under its own folder called forms.
I have set them up and placed them in my pages and they work perfect....well almost perfect...
When i fill one of the3 forms out and click send it produces a error message (on the page which should come up when you dont fill a form in corrctly)
Anyway heres what it says:
Form my General Enqieries form it says:
Warning: Cannot modify header information - headers already sent by (output started at /data01/admin1/public_html/Forms/use/GeneralEnquiries/process.php:14) in /data01/admin1/public_html/Forms/use/GeneralEnquiries/process.php on line 39
For my Quick Quote form it says:
Warning: Cannot modify header information - headers already sent by (output started at /data01/admin1/public_html/Forms/use/QuickQuote/process.php:5) in /data01/admin1/public_html/Forms/use/QuickQuote/process.php on line 64
.......and so on for the other form i have....
BUT!.....i still recieve the email with the form results on it!
Help pleaseeeee
NogDog
12-28-2005, 09:12 PM
If you use any functions that send header info, such as header(), setcookie(), or session_start(), then you cannot have any output before those commands, including echo statements or any text (even linefeeds or whitespace) that is not inside of the <?php ... ?> tags. Alternatively, you can use the ob_start() and ob_end_flush() functions to control output (see http://www.php.net/ob_start ).
jamie007
12-29-2005, 06:57 AM
Well since that makes no sence to me at all can you show me...
Heres what i have in my process.php file for General Enqiries.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Form</title>
</head>
<body background="http://www.workbenchdesigns.co.uk/Images/Backing%20for%20form%20on%20Main%20Page.gif" style="background-attachment: fixed">
<table cellpadding="0" cellspacing="0" width="206">
<!-- MSTableType="nolayout" -->
<tr>
<td height="149" valign="top">
<font face="Arial" style="font-size: 8pt"> <?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','FullName');
pt_register('POST','EmailAddress');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($FullName=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$EmailAddress)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Full Name: ".$FullName."
Email Address: ".$EmailAddress."
Message: ".$Message."
";
$message = stripslashes($message);
mail("onlineforms@workbenchdesigns.co.uk","Form Submitted at your website",$message,"From: phpFormGenerator");
header("Refresh: 0;url=http://www.workbenchdesigns.co.uk/Thank%20you%20for%20contacting.htm");
?><?php
}
?><br>
<A HREF="javascript:history.go(-1)">
<span style="text-decoration: none"><font color="#000000"><br>
[Go Back to Form]</font></span></A></font></td>
</tr>
</table>
</body>
</html>
Now what... :( lol
scaiferw
12-29-2005, 07:37 AM
Headers are information about how a web page is set up that must be sent from the server to the browser before any of the content of the page is sent. Once even a single character or empty line is sent from the server, it's too late to send header information.
On your page you've sent the structure of the page the title, and some of the content, then about 3/4 of the way down you have a line that starts with "header(". That's trying to send header information but it's not happening.
I can't tell too easily what's happening in your page, but I do notice one thing right away. On line 41 of your code I see ?><?php, which doesn't make sense as it closes and opens the tags immediately. You can probably remove that line altogether.
Other than that, I think the key is in moving parts of your code to the top of the page, but it will take a more experienced coder than me to be more specific.
Good luck,
Rob
Well since that makes no sence to me at all can you show me...
Heres what i have in my process.php file for General Enqiries.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Form</title>
</head>
<body background="http://www.workbenchdesigns.co.uk/Images/Backing%20for%20form%20on%20Main%20Page.gif" style="background-attachment: fixed">
<table cellpadding="0" cellspacing="0" width="206">
<!-- MSTableType="nolayout" -->
<tr>
<td height="149" valign="top">
<font face="Arial" style="font-size: 8pt"> <?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','FullName');
pt_register('POST','EmailAddress');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($FullName=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$EmailAddress)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Full Name: ".$FullName."
Email Address: ".$EmailAddress."
Message: ".$Message."
";
$message = stripslashes($message);
mail("onlineforms@workbenchdesigns.co.uk","Form Submitted at your website",$message,"From: phpFormGenerator");
header("Refresh: 0;url=http://www.workbenchdesigns.co.uk/Thank%20you%20for%20contacting.htm");
?><?php
}
?><br>
<A HREF="javascript:history.go(-1)">
<span style="text-decoration: none"><font color="#000000"><br>
[Go Back to Form]</font></span></A></font></td>
</tr>
</table>
</body>
</html>
Now what... :( lol
NogDog
12-29-2005, 08:33 AM
Try adding this to the very top of the file (no spaces or empty lines before it):
<?php
ob_start(); // begin output buffering
?>
At the end of the page, add:
<?php
ob_end_flush(); // output the buffer
?>
jamie007
12-29-2005, 10:26 AM
nope that don't seem to work :(
jamie007
12-30-2005, 12:25 PM
Can anyone help :(
Cytael
12-30-2005, 09:02 PM
just a shot in the dark here without any testing on my part, but you might try replacing this line:
header("Refresh: 0;url=http://www.workbenchdesigns.co.uk/Thank%20you%20for%20contacting.htm");
with this:
echo "<script language=\"JavaScript\"> window.location=\"http://www.workbenchdesigns.co.uk/Thank%20you%20for%20contacting.htm\"; </script>";
//write that all on one line, regardless of how it shows up here :)
basically using PHP to write the javascript to perform the same function as the line that's messing you up
Of course, you then have to consider that some folks turn off javascript, so it might be a better idea to just echo the contents of that thank you page directly
SpectreReturns
01-01-2006, 01:50 AM
Instead of using a refresh header, you should send a location.
jamie007
01-01-2006, 11:33 AM
......and how do i do that :(
LiLcRaZyFuZzY
01-01-2006, 11:38 AM
using the header() (http://php.net/header) function (see 3rd example)