/    Sign up×
Community /Pin to ProfileBookmark

Hellpppppp AHHH

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 ?? 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:
[B]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[/B]

For my Quick Quote form it says:
[B]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[/B]

…….and so on for the other form i have….

BUT!…..i still recieve the email with the form results on it!
Help pleaseeeee

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 29.2005 — 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 ).
Copy linkTweet thisAlerts:
@jamie007authorDec 29.2005 — 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.
[code=php]<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">&nbsp;<?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("/(1512)|(15)|(12)/","&nbsp;<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("[email protected]","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>[/code]



Now what... ? lol
Copy linkTweet thisAlerts:
@scaiferwDec 29.2005 — 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 [B][FONT=Courier New]?><?php[/FONT][/B], 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.

[SIZE=2][B]<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">&nbsp;<?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("/(1512)|(15)|(12)/","&nbsp;<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("[email protected]","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>[/B]
[/SIZE]



Now what... ? lol[/QUOTE]
Copy linkTweet thisAlerts:
@NogDogDec 29.2005 — Try adding this to the very top of the file (no spaces or empty lines before it):
[code=php]
<?php
ob_start(); // begin output buffering
?>
[/code]

At the end of the page, add:
[code=php]
<?php
ob_end_flush(); // output the buffer
?>
[/code]
Copy linkTweet thisAlerts:
@jamie007authorDec 29.2005 — nope that don't seem to work ?
Copy linkTweet thisAlerts:
@jamie007authorDec 30.2005 — Can anyone help ?
Copy linkTweet thisAlerts:
@CytaelDec 31.2005 — just a shot in the dark here without any testing on my part, but you might try replacing this line:
[code=php]header("Refresh: 0;url=http://www.workbenchdesigns.co.uk/Thank%20you%20for%20contacting.htm");[/code]

with this:
[code=php]
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 :)
[/code]


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
Copy linkTweet thisAlerts:
@SpectreReturnsJan 01.2006 — Instead of using a refresh header, you should send a location.
Copy linkTweet thisAlerts:
@jamie007authorJan 01.2006 — ......and how do i do that ?
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 01.2006 — using the [url=http://php.net/header]header()[/url] function (see 3rd example)
×

Success!

Help @jamie007 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...