Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
....hooligan #1
[PHP] Header problem
Hey again, im trying to redirect the user to another page after a succesful
INSERT into a database,
by using the header(); function and i get the following message
Warning: Cannot modify header information - headers already sent by (output
started at c:\htdocs\site_test\register.php:59) in
c:\htdocs\site_test\register.php on line 74
Its a self processing form. I made it like that so users wont have to go
back and forth between pages to enter information could that be causing the
problem?
What should i use to redirect the users to the success.php page
i originally tried
header("Refresh: 2; URL=success.php");
header("Location: success.php");
but both got the same problem
Thanks in advance
....hooligan Guest
-
DG Header renderer problem
I've also stumbled upon this issue, the problem occurs when the data grid is using variable row heights. here's an example with the problem... -
#39019 [NEW]: Header And Location Problem
From: bojan dot saksida at volja dot net Operating system: Windows XP PHP version: 6CVS-2006-10-02 (snap) PHP Bug Type: ... -
header problem
Hi I have 2 sites 1 uses php 4.0.6 (old i know but not possible to have it upgraded.) the other uses 4.3.7 (soon 4.3.8) Now on 4.3.7 i use... -
Problem with including a header
I have the following file structure: / header.asp test.asp /subDir testpage.asp /images I would like to have header.asp to be usable from... -
set header problem
Hi All Response.setHeader("Content-disposition", "attachment; filename="+ fileName + strExt); works for IE 5.5 but not in netscape . IE 5.5... -
rob::db #2
Re: [PHP] Header problem
This is a common problem. The headers have to be sent *before* everything
else -- if you've sent any HTML at all, even just a line break or a bit of
white space somewhere, the headers won't send. So just make sure the headers
get sent by a PHP block that appears before the opening HTML tag.
Location is the best redirection header to use...
.....hooligan wrote:> Hey again, im trying to redirect the user to another page after a
> succesful INSERT into a database,
> by using the header(); function and i get the following message
>
> Warning: Cannot modify header information - headers already sent by
> (output started at c:\htdocs\site_test\register.php:59) in
> c:\htdocs\site_test\register.php on line 74
>
> Its a self processing form. I made it like that so users wont have to
> go back and forth between pages to enter information could that be
> causing the problem?
> What should i use to redirect the users to the success.php page
>
> i originally tried
>
> header("Refresh: 2; URL=success.php");
> header("Location: success.php");
>
> but both got the same problem
>
> Thanks in advance
rob::db Guest
-
....hooligan #3
Re: [PHP] Header problem
The header is in the php tags before the <html> tags and it still happens.
Is it something im setting in the top php tags that stuffs me up
Heres what in the opening php tags. The header appears down the bottom of it
<?php
include "inc.conn.php";
if(isset($_POST['submit']) && $_POST['submit'] == "Submit") {
$emailPattern = '/^\w[-.\w]*@([-a-z0-9]+\.)+[a-z]{2,4}$/i';
$error1 = "";
$error2 = "";
$error3 = "";
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$confpassword = $_POST['confpassword'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$suburb = $_POST['suburb'];
$city = $_POST['city'];
$postcode = $_POST['postcode'];
$gender = $_POST['gender'];
$country = $_POST['country'];
if (empty($username)) {
$error1 .= "<tr align=\"center\"><td class=\"error\">You must enter a
username</td></tr>";
}
if (empty($email)) {
$error1 .= "<tr align=\"center\"><td class=\"error\">You must enter a
email address</td></tr>";
}else if(!preg_match($emailPattern,$email)) {
$error1 .= "<tr align=\"center\"><td class=\"error\">Invalid email
address</td></tr>";
}
if (empty($password)) {
$error1 .= "<tr align=\"center\"><td class=\"error\">You must enter a
password</td></tr>";
}
if (empty($confpassword)) {
$error1 .= "<tr align=\"center\"><td class=\"error\">You must enter a
confirm password</td></tr>";
}
if(isset($password) && isset($confpassword)) {
if($password != $confpassword) {
$error1 .= "<tr align=\"center\"><td class=\"error\">Confirm Password
must match Password feild</td></tr>";
$password = "";
$confpassword = "";
}
}
if (empty($firstname)) {
$error2 .= "<tr align=\"center\"><td class=\"error\">You must enter your
first name</td></tr>";
}
if (empty($lastname)) {
$error2 .= "<tr align=\"center\"><td class=\"error\">You must enter your
last name</td></tr>";
}
if (empty($address)) {
$error3 .= "<tr align=\"center\"><td class=\"error\">You must enter your
email address</td></tr>";
}
if (empty($suburb)) {
$error3 .= "<tr align=\"center\"><td class=\"error\">You must enter your
suburb</td></tr>";
}
if (empty($city)) {
$error3 .= "<tr align=\"center\"><td class=\"error\">You must enter your
city</td></tr>";
}
if (empty($country)) {
$error3 .= "<tr align=\"center\"><td class=\"error\">You must enter your
country</td></tr>";
}
if(isset($error1)) {
echo "<table width=\"300\" border=\"1\" align=\"center\"
bordercolor=\"#000000\">" . $error1 . "</table>";
}
if (empty($error1) && empty($error2) && empty($error3)) {
$sql = "SELECT user_name " .
"FROM members " .
"WHERE user_name = '$username'";
$result = mysql_query($sql)
or die(mysql_error());
if(mysql_num_rows($result) == 0) {
$sql = "INSERT INTO members (user_name, password, email, first_name,
last_name, gender, address, suburb, city, postcode, country) " .
"VALUES ('$username', PASSWORD('$password'), '$email', '$firstname',
'$lastname', '$gender', '$address', '$suburb', '$city', '$postcode',
'$country');";
$result = mysql_query($sql)
or die(mysql_error());
header("Location:sendconf.php");
} else {
echo "<p align=\"center\" class=\"black\">Username \"" . $username . "\"
is already taken</p>";
$username = "";
}
}
}
?>
"rob::db" <rob@digitalburn.net> wrote in message
news:d8o1iq$kcl$1@forums.macromedia.com...> This is a common problem. The headers have to be sent *before* everything
> else -- if you've sent any HTML at all, even just a line break or a bit of
> white space somewhere, the headers won't send. So just make sure the
> headers
> get sent by a PHP block that appears before the opening HTML tag.
>
> Location is the best redirection header to use...
>
>
> ....hooligan wrote:>>> Hey again, im trying to redirect the user to another page after a
>> succesful INSERT into a database,
>> by using the header(); function and i get the following message
>>
>> Warning: Cannot modify header information - headers already sent by
>> (output started at c:\htdocs\site_test\register.php:59) in
>> c:\htdocs\site_test\register.php on line 74
>>
>> Its a self processing form. I made it like that so users wont have to
>> go back and forth between pages to enter information could that be
>> causing the problem?
>> What should i use to redirect the users to the success.php page
>>
>> i originally tried
>>
>> header("Refresh: 2; URL=success.php");
>> header("Location: success.php");
>>
>> but both got the same problem
>>
>> Thanks in advance
>
....hooligan Guest
-
rob::db #4
Re: [PHP] Header problem
Have you got a space in the file before the first PHP tag opens?
.....hooligan wrote:> The header is in the php tags before the <html> tags and it still
> happens. Is it something im setting in the top php tags that stuffs
> me up
> Heres what in the opening php tags. The header appears down the
> bottom of it
>
> <?php
> include "inc.conn.php";
> if(isset($_POST['submit']) && $_POST['submit'] == "Submit") {
> $emailPattern = '/^\w[-.\w]*@([-a-z0-9]+\.)+[a-z]{2,4}$/i';
> $error1 = "";
> $error2 = "";
> $error3 = "";
> $username = $_POST['username'];
> $email = $_POST['email'];
> $password = $_POST['password'];
> $confpassword = $_POST['confpassword'];
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'];
> $address = $_POST['address'];
> $suburb = $_POST['suburb'];
> $city = $_POST['city'];
> $postcode = $_POST['postcode'];
> $gender = $_POST['gender'];
> $country = $_POST['country'];
>
> if (empty($username)) {
> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
> enter a username</td></tr>";
> }
> if (empty($email)) {
> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
> enter a email address</td></tr>";
> }else if(!preg_match($emailPattern,$email)) {
> $error1 .= "<tr align=\"center\"><td class=\"error\">Invalid email
> address</td></tr>";
> }
> if (empty($password)) {
> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
> enter a password</td></tr>";
> }
> if (empty($confpassword)) {
> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
> enter a confirm password</td></tr>";
> }
> if(isset($password) && isset($confpassword)) {
> if($password != $confpassword) {
> $error1 .= "<tr align=\"center\"><td class=\"error\">Confirm
> Password must match Password feild</td></tr>";
> $password = "";
> $confpassword = "";
> }
> }
> if (empty($firstname)) {
> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
> enter your first name</td></tr>";
> }
> if (empty($lastname)) {
> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
> enter your last name</td></tr>";
> }
> if (empty($address)) {
> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
> enter your email address</td></tr>";
> }
> if (empty($suburb)) {
> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
> enter your suburb</td></tr>";
> }
> if (empty($city)) {
> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
> enter your city</td></tr>";
> }
> if (empty($country)) {
> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
> enter your country</td></tr>";
> }
>
> if(isset($error1)) {
> echo "<table width=\"300\" border=\"1\" align=\"center\"
> bordercolor=\"#000000\">" . $error1 . "</table>";
> }
>
> if (empty($error1) && empty($error2) && empty($error3)) {
> $sql = "SELECT user_name " .
> "FROM members " .
> "WHERE user_name = '$username'";
> $result = mysql_query($sql)
> or die(mysql_error());
>
> if(mysql_num_rows($result) == 0) {
> $sql = "INSERT INTO members (user_name, password, email,
> first_name, last_name, gender, address, suburb, city, postcode,
> country) " . "VALUES ('$username', PASSWORD('$password'),
> '$email', '$firstname', '$lastname', '$gender', '$address',
> '$suburb', '$city', '$postcode', '$country');";
> $result = mysql_query($sql)
> or die(mysql_error());
> header("Location:sendconf.php");
> } else {
> echo "<p align=\"center\" class=\"black\">Username \"" .
> $username . "\" is already taken</p>";
> $username = "";
> }
> }
> }>>>
> "rob::db" <rob@digitalburn.net> wrote in message
> news:d8o1iq$kcl$1@forums.macromedia.com...>> This is a common problem. The headers have to be sent *before*
>> everything else -- if you've sent any HTML at all, even just a line
>> break or a bit of white space somewhere, the headers won't send. So
>> just make sure the headers
>> get sent by a PHP block that appears before the opening HTML tag.
>>
>> Location is the best redirection header to use...
>>
>>
>> ....hooligan wrote:>>> Hey again, im trying to redirect the user to another page after a
>>> succesful INSERT into a database,
>>> by using the header(); function and i get the following message
>>>
>>> Warning: Cannot modify header information - headers already sent by
>>> (output started at c:\htdocs\site_test\register.php:59) in
>>> c:\htdocs\site_test\register.php on line 74
>>>
>>> Its a self processing form. I made it like that so users wont have
>>> to go back and forth between pages to enter information could that
>>> be causing the problem?
>>> What should i use to redirect the users to the success.php page
>>>
>>> i originally tried
>>>
>>> header("Refresh: 2; URL=success.php");
>>> header("Location: success.php");
>>>
>>> but both got the same problem
>>>
>>> Thanks in advance
rob::db Guest
-
....hooligan #5
Re: [PHP] Header problem
Nope no white space? Anything else it could be?
"rob::db" <rob@digitalburn.net> wrote in message
news:d8o4a2$nem$1@forums.macromedia.com...> Have you got a space in the file before the first PHP tag opens?
>
>
> ....hooligan wrote:>>> The header is in the php tags before the <html> tags and it still
>> happens. Is it something im setting in the top php tags that stuffs
>> me up
>> Heres what in the opening php tags. The header appears down the
>> bottom of it
>>
>> <?php
>> include "inc.conn.php";
>> if(isset($_POST['submit']) && $_POST['submit'] == "Submit") {
>> $emailPattern = '/^\w[-.\w]*@([-a-z0-9]+\.)+[a-z]{2,4}$/i';
>> $error1 = "";
>> $error2 = "";
>> $error3 = "";
>> $username = $_POST['username'];
>> $email = $_POST['email'];
>> $password = $_POST['password'];
>> $confpassword = $_POST['confpassword'];
>> $firstname = $_POST['firstname'];
>> $lastname = $_POST['lastname'];
>> $address = $_POST['address'];
>> $suburb = $_POST['suburb'];
>> $city = $_POST['city'];
>> $postcode = $_POST['postcode'];
>> $gender = $_POST['gender'];
>> $country = $_POST['country'];
>>
>> if (empty($username)) {
>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter a username</td></tr>";
>> }
>> if (empty($email)) {
>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter a email address</td></tr>";
>> }else if(!preg_match($emailPattern,$email)) {
>> $error1 .= "<tr align=\"center\"><td class=\"error\">Invalid email
>> address</td></tr>";
>> }
>> if (empty($password)) {
>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter a password</td></tr>";
>> }
>> if (empty($confpassword)) {
>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter a confirm password</td></tr>";
>> }
>> if(isset($password) && isset($confpassword)) {
>> if($password != $confpassword) {
>> $error1 .= "<tr align=\"center\"><td class=\"error\">Confirm
>> Password must match Password feild</td></tr>";
>> $password = "";
>> $confpassword = "";
>> }
>> }
>> if (empty($firstname)) {
>> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter your first name</td></tr>";
>> }
>> if (empty($lastname)) {
>> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter your last name</td></tr>";
>> }
>> if (empty($address)) {
>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter your email address</td></tr>";
>> }
>> if (empty($suburb)) {
>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter your suburb</td></tr>";
>> }
>> if (empty($city)) {
>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter your city</td></tr>";
>> }
>> if (empty($country)) {
>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>> enter your country</td></tr>";
>> }
>>
>> if(isset($error1)) {
>> echo "<table width=\"300\" border=\"1\" align=\"center\"
>> bordercolor=\"#000000\">" . $error1 . "</table>";
>> }
>>
>> if (empty($error1) && empty($error2) && empty($error3)) {
>> $sql = "SELECT user_name " .
>> "FROM members " .
>> "WHERE user_name = '$username'";
>> $result = mysql_query($sql)
>> or die(mysql_error());
>>
>> if(mysql_num_rows($result) == 0) {
>> $sql = "INSERT INTO members (user_name, password, email,
>> first_name, last_name, gender, address, suburb, city, postcode,
>> country) " . "VALUES ('$username', PASSWORD('$password'),
>> '$email', '$firstname', '$lastname', '$gender', '$address',
>> '$suburb', '$city', '$postcode', '$country');";
>> $result = mysql_query($sql)
>> or die(mysql_error());
>> header("Location:sendconf.php");
>> } else {
>> echo "<p align=\"center\" class=\"black\">Username \"" .
>> $username . "\" is already taken</p>";
>> $username = "";
>> }
>> }
>> }>>>>>
>> "rob::db" <rob@digitalburn.net> wrote in message
>> news:d8o1iq$kcl$1@forums.macromedia.com...>>> This is a common problem. The headers have to be sent *before*
>>> everything else -- if you've sent any HTML at all, even just a line
>>> break or a bit of white space somewhere, the headers won't send. So
>>> just make sure the headers
>>> get sent by a PHP block that appears before the opening HTML tag.
>>>
>>> Location is the best redirection header to use...
>>>
>>>
>>> ....hooligan wrote:
>>>> Hey again, im trying to redirect the user to another page after a
>>>> succesful INSERT into a database,
>>>> by using the header(); function and i get the following message
>>>>
>>>> Warning: Cannot modify header information - headers already sent by
>>>> (output started at c:\htdocs\site_test\register.php:59) in
>>>> c:\htdocs\site_test\register.php on line 74
>>>>
>>>> Its a self processing form. I made it like that so users wont have
>>>> to go back and forth between pages to enter information could that
>>>> be causing the problem?
>>>> What should i use to redirect the users to the success.php page
>>>>
>>>> i originally tried
>>>>
>>>> header("Refresh: 2; URL=success.php");
>>>> header("Location: success.php");
>>>>
>>>> but both got the same problem
>>>>
>>>> Thanks in advance
>
....hooligan Guest
-
....hooligan #6
Re: [PHP] Header problem
I think i worked it out. It doesnt like this line if(isset($error1)) {
"....hooligan" <robochippy@aapt.net.au> wrote in message
news:d8p234$343$1@forums.macromedia.com...> Nope no white space? Anything else it could be?
>
> "rob::db" <rob@digitalburn.net> wrote in message
> news:d8o4a2$nem$1@forums.macromedia.com...>>> Have you got a space in the file before the first PHP tag opens?
>>
>>
>> ....hooligan wrote:>>>>> The header is in the php tags before the <html> tags and it still
>>> happens. Is it something im setting in the top php tags that stuffs
>>> me up
>>> Heres what in the opening php tags. The header appears down the
>>> bottom of it
>>>
>>> <?php
>>> include "inc.conn.php";
>>> if(isset($_POST['submit']) && $_POST['submit'] == "Submit") {
>>> $emailPattern = '/^\w[-.\w]*@([-a-z0-9]+\.)+[a-z]{2,4}$/i';
>>> $error1 = "";
>>> $error2 = "";
>>> $error3 = "";
>>> $username = $_POST['username'];
>>> $email = $_POST['email'];
>>> $password = $_POST['password'];
>>> $confpassword = $_POST['confpassword'];
>>> $firstname = $_POST['firstname'];
>>> $lastname = $_POST['lastname'];
>>> $address = $_POST['address'];
>>> $suburb = $_POST['suburb'];
>>> $city = $_POST['city'];
>>> $postcode = $_POST['postcode'];
>>> $gender = $_POST['gender'];
>>> $country = $_POST['country'];
>>>
>>> if (empty($username)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a username</td></tr>";
>>> }
>>> if (empty($email)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a email address</td></tr>";
>>> }else if(!preg_match($emailPattern,$email)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">Invalid email
>>> address</td></tr>";
>>> }
>>> if (empty($password)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a password</td></tr>";
>>> }
>>> if (empty($confpassword)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a confirm password</td></tr>";
>>> }
>>> if(isset($password) && isset($confpassword)) {
>>> if($password != $confpassword) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">Confirm
>>> Password must match Password feild</td></tr>";
>>> $password = "";
>>> $confpassword = "";
>>> }
>>> }
>>> if (empty($firstname)) {
>>> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your first name</td></tr>";
>>> }
>>> if (empty($lastname)) {
>>> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your last name</td></tr>";
>>> }
>>> if (empty($address)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your email address</td></tr>";
>>> }
>>> if (empty($suburb)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your suburb</td></tr>";
>>> }
>>> if (empty($city)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your city</td></tr>";
>>> }
>>> if (empty($country)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your country</td></tr>";
>>> }
>>>
>>> if(isset($error1)) {
>>> echo "<table width=\"300\" border=\"1\" align=\"center\"
>>> bordercolor=\"#000000\">" . $error1 . "</table>";
>>> }
>>>
>>> if (empty($error1) && empty($error2) && empty($error3)) {
>>> $sql = "SELECT user_name " .
>>> "FROM members " .
>>> "WHERE user_name = '$username'";
>>> $result = mysql_query($sql)
>>> or die(mysql_error());
>>>
>>> if(mysql_num_rows($result) == 0) {
>>> $sql = "INSERT INTO members (user_name, password, email,
>>> first_name, last_name, gender, address, suburb, city, postcode,
>>> country) " . "VALUES ('$username', PASSWORD('$password'),
>>> '$email', '$firstname', '$lastname', '$gender', '$address',
>>> '$suburb', '$city', '$postcode', '$country');";
>>> $result = mysql_query($sql)
>>> or die(mysql_error());
>>> header("Location:sendconf.php");
>>> } else {
>>> echo "<p align=\"center\" class=\"black\">Username \"" .
>>> $username . "\" is already taken</p>";
>>> $username = "";
>>> }
>>> }
>>> }
>>>>
>>>
>>> "rob::db" <rob@digitalburn.net> wrote in message
>>> news:d8o1iq$kcl$1@forums.macromedia.com...
>>>> This is a common problem. The headers have to be sent *before*
>>>> everything else -- if you've sent any HTML at all, even just a line
>>>> break or a bit of white space somewhere, the headers won't send. So
>>>> just make sure the headers
>>>> get sent by a PHP block that appears before the opening HTML tag.
>>>>
>>>> Location is the best redirection header to use...
>>>>
>>>>
>>>> ....hooligan wrote:
>>>>> Hey again, im trying to redirect the user to another page after a
>>>>> succesful INSERT into a database,
>>>>> by using the header(); function and i get the following message
>>>>>
>>>>> Warning: Cannot modify header information - headers already sent by
>>>>> (output started at c:\htdocs\site_test\register.php:59) in
>>>>> c:\htdocs\site_test\register.php on line 74
>>>>>
>>>>> Its a self processing form. I made it like that so users wont have
>>>>> to go back and forth between pages to enter information could that
>>>>> be causing the problem?
>>>>> What should i use to redirect the users to the success.php page
>>>>>
>>>>> i originally tried
>>>>>
>>>>> header("Refresh: 2; URL=success.php");
>>>>> header("Location: success.php");
>>>>>
>>>>> but both got the same problem
>>>>>
>>>>> Thanks in advance
>>
>
....hooligan Guest
-
....hooligan #7
Re: [PHP] Header problem
Its all good just worked out how to fix it. Thanks for the help again.
"....hooligan" <robochippy@aapt.net.au> wrote in message
news:d8p234$343$1@forums.macromedia.com...> Nope no white space? Anything else it could be?
>
> "rob::db" <rob@digitalburn.net> wrote in message
> news:d8o4a2$nem$1@forums.macromedia.com...>>> Have you got a space in the file before the first PHP tag opens?
>>
>>
>> ....hooligan wrote:>>>>> The header is in the php tags before the <html> tags and it still
>>> happens. Is it something im setting in the top php tags that stuffs
>>> me up
>>> Heres what in the opening php tags. The header appears down the
>>> bottom of it
>>>
>>> <?php
>>> include "inc.conn.php";
>>> if(isset($_POST['submit']) && $_POST['submit'] == "Submit") {
>>> $emailPattern = '/^\w[-.\w]*@([-a-z0-9]+\.)+[a-z]{2,4}$/i';
>>> $error1 = "";
>>> $error2 = "";
>>> $error3 = "";
>>> $username = $_POST['username'];
>>> $email = $_POST['email'];
>>> $password = $_POST['password'];
>>> $confpassword = $_POST['confpassword'];
>>> $firstname = $_POST['firstname'];
>>> $lastname = $_POST['lastname'];
>>> $address = $_POST['address'];
>>> $suburb = $_POST['suburb'];
>>> $city = $_POST['city'];
>>> $postcode = $_POST['postcode'];
>>> $gender = $_POST['gender'];
>>> $country = $_POST['country'];
>>>
>>> if (empty($username)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a username</td></tr>";
>>> }
>>> if (empty($email)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a email address</td></tr>";
>>> }else if(!preg_match($emailPattern,$email)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">Invalid email
>>> address</td></tr>";
>>> }
>>> if (empty($password)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a password</td></tr>";
>>> }
>>> if (empty($confpassword)) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter a confirm password</td></tr>";
>>> }
>>> if(isset($password) && isset($confpassword)) {
>>> if($password != $confpassword) {
>>> $error1 .= "<tr align=\"center\"><td class=\"error\">Confirm
>>> Password must match Password feild</td></tr>";
>>> $password = "";
>>> $confpassword = "";
>>> }
>>> }
>>> if (empty($firstname)) {
>>> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your first name</td></tr>";
>>> }
>>> if (empty($lastname)) {
>>> $error2 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your last name</td></tr>";
>>> }
>>> if (empty($address)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your email address</td></tr>";
>>> }
>>> if (empty($suburb)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your suburb</td></tr>";
>>> }
>>> if (empty($city)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your city</td></tr>";
>>> }
>>> if (empty($country)) {
>>> $error3 .= "<tr align=\"center\"><td class=\"error\">You must
>>> enter your country</td></tr>";
>>> }
>>>
>>> if(isset($error1)) {
>>> echo "<table width=\"300\" border=\"1\" align=\"center\"
>>> bordercolor=\"#000000\">" . $error1 . "</table>";
>>> }
>>>
>>> if (empty($error1) && empty($error2) && empty($error3)) {
>>> $sql = "SELECT user_name " .
>>> "FROM members " .
>>> "WHERE user_name = '$username'";
>>> $result = mysql_query($sql)
>>> or die(mysql_error());
>>>
>>> if(mysql_num_rows($result) == 0) {
>>> $sql = "INSERT INTO members (user_name, password, email,
>>> first_name, last_name, gender, address, suburb, city, postcode,
>>> country) " . "VALUES ('$username', PASSWORD('$password'),
>>> '$email', '$firstname', '$lastname', '$gender', '$address',
>>> '$suburb', '$city', '$postcode', '$country');";
>>> $result = mysql_query($sql)
>>> or die(mysql_error());
>>> header("Location:sendconf.php");
>>> } else {
>>> echo "<p align=\"center\" class=\"black\">Username \"" .
>>> $username . "\" is already taken</p>";
>>> $username = "";
>>> }
>>> }
>>> }
>>>>
>>>
>>> "rob::db" <rob@digitalburn.net> wrote in message
>>> news:d8o1iq$kcl$1@forums.macromedia.com...
>>>> This is a common problem. The headers have to be sent *before*
>>>> everything else -- if you've sent any HTML at all, even just a line
>>>> break or a bit of white space somewhere, the headers won't send. So
>>>> just make sure the headers
>>>> get sent by a PHP block that appears before the opening HTML tag.
>>>>
>>>> Location is the best redirection header to use...
>>>>
>>>>
>>>> ....hooligan wrote:
>>>>> Hey again, im trying to redirect the user to another page after a
>>>>> succesful INSERT into a database,
>>>>> by using the header(); function and i get the following message
>>>>>
>>>>> Warning: Cannot modify header information - headers already sent by
>>>>> (output started at c:\htdocs\site_test\register.php:59) in
>>>>> c:\htdocs\site_test\register.php on line 74
>>>>>
>>>>> Its a self processing form. I made it like that so users wont have
>>>>> to go back and forth between pages to enter information could that
>>>>> be causing the problem?
>>>>> What should i use to redirect the users to the success.php page
>>>>>
>>>>> i originally tried
>>>>>
>>>>> header("Refresh: 2; URL=success.php");
>>>>> header("Location: success.php");
>>>>>
>>>>> but both got the same problem
>>>>>
>>>>> Thanks in advance
>>
>
....hooligan Guest



Reply With Quote

