Problem with header()
Posted: Mon Feb 16, 2004 6:47 am
I ahve a page which is updataing a database and then sending a confirmation email. It shoule then go to a page saying cheers.
I am getting an error "
Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site8/fst/var/www/html/dbshoes/InsertCustomer.php:9) in /home/virtual/site8/fst/var/www/html/dbshoes/InsertCustomer.php on line 107"
The databse is updating and the email is being sent.
below is my code:
$Firstname = $_POST["requiredName"];
$Surname = $_POST["requiredLastname"];
$Title = $_POST["requiredTitle"];
$Add1 = $_POST["requiredAdd1"];
$Add2 = $_POST["Add2"];
$City = $_POST["requiredCity"];
$County = $_POST["requiredCounty"];
$Postcode = $_POST["requiredPostCode"];
$Phone = $_POST["CustPhone"];
$email = $_POST["requiredEmail"];
$Shoesize = $_POST["requiredShoeSize"];
$Width = $_POST["requiredwidth"];
$Gender = $_POST["requiredGender"];
$Passw = $_POST["requiredPass"];
$Agree = $_POST["requiredAgree"];
$radd = $_POST["requiredEmail"];
$thanks = $_POST["thank"];
$sAddr = $_POST["senderaddr"];
$result = mysql_query("INSERT INTO tblcustomer( Firstname, Surname, Title, CustStreet, CustTown, CustCity, CustCounty, Postcode, CustPhone, CustEmail, DateEntered, ShoeSize, CustWidth, CustGender, LoginID, Agreed) VALUES( '$Firstname', '$Surname', '$Title', '$Add1', '$Add2', '$City', '$County', '$Postcode', '$Phone', '$email', '$date', '$Shoesize', '$Width', '$Gender', '$Passw', '$Agree')", $linkID)or die(mysql_error());
if ($result == true)
{
//print "Thank you for registering an email will be sent shortly confirming you details<p>";
$mail = ("
DB Shoes website Registration\n
---------------------------------------------------------------------\n
Thank you for registering to receive news on new products and services. \n
Please check the details below to ensure they are correct\n\n
Firstname: $Firstname \n
Surnamename: $Surname \n
Tittle: $Title \n
Address Line 1: $Add1 \n
Address Line 2: $Add2 \n
City: $City \n
County: $County \n
Post Code: $Postcode\n
Email address: $email \n
Phone: $Phone \n
Shoesize: $Shoesize \n
Width: $Width \n
Gender: $Gender \n
\n
Your password is: $Passw \n
\n
Your login username is your email address \n
---------------------------------------------------------------------\n
DB Shoes Limited, Irchester Road, Rushden, Northamptonshire NN10 9XF, England\n
Tel: +44 (0)1933 359217 Fax: +44 (0)1933 410218 Email: enquiries@dbshoes.co.uk\n
");
mail( $radd, $subject,
$mail, "From: $sAddr" );
header( "Location: $thanks" );
Any help appreciated
I am getting an error "
Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site8/fst/var/www/html/dbshoes/InsertCustomer.php:9) in /home/virtual/site8/fst/var/www/html/dbshoes/InsertCustomer.php on line 107"
The databse is updating and the email is being sent.
below is my code:
$Firstname = $_POST["requiredName"];
$Surname = $_POST["requiredLastname"];
$Title = $_POST["requiredTitle"];
$Add1 = $_POST["requiredAdd1"];
$Add2 = $_POST["Add2"];
$City = $_POST["requiredCity"];
$County = $_POST["requiredCounty"];
$Postcode = $_POST["requiredPostCode"];
$Phone = $_POST["CustPhone"];
$email = $_POST["requiredEmail"];
$Shoesize = $_POST["requiredShoeSize"];
$Width = $_POST["requiredwidth"];
$Gender = $_POST["requiredGender"];
$Passw = $_POST["requiredPass"];
$Agree = $_POST["requiredAgree"];
$radd = $_POST["requiredEmail"];
$thanks = $_POST["thank"];
$sAddr = $_POST["senderaddr"];
$result = mysql_query("INSERT INTO tblcustomer( Firstname, Surname, Title, CustStreet, CustTown, CustCity, CustCounty, Postcode, CustPhone, CustEmail, DateEntered, ShoeSize, CustWidth, CustGender, LoginID, Agreed) VALUES( '$Firstname', '$Surname', '$Title', '$Add1', '$Add2', '$City', '$County', '$Postcode', '$Phone', '$email', '$date', '$Shoesize', '$Width', '$Gender', '$Passw', '$Agree')", $linkID)or die(mysql_error());
if ($result == true)
{
//print "Thank you for registering an email will be sent shortly confirming you details<p>";
$mail = ("
DB Shoes website Registration\n
---------------------------------------------------------------------\n
Thank you for registering to receive news on new products and services. \n
Please check the details below to ensure they are correct\n\n
Firstname: $Firstname \n
Surnamename: $Surname \n
Tittle: $Title \n
Address Line 1: $Add1 \n
Address Line 2: $Add2 \n
City: $City \n
County: $County \n
Post Code: $Postcode\n
Email address: $email \n
Phone: $Phone \n
Shoesize: $Shoesize \n
Width: $Width \n
Gender: $Gender \n
\n
Your password is: $Passw \n
\n
Your login username is your email address \n
---------------------------------------------------------------------\n
DB Shoes Limited, Irchester Road, Rushden, Northamptonshire NN10 9XF, England\n
Tel: +44 (0)1933 359217 Fax: +44 (0)1933 410218 Email: enquiries@dbshoes.co.uk\n
");
mail( $radd, $subject,
$mail, "From: $sAddr" );
header( "Location: $thanks" );
Any help appreciated