/    Sign up×
Community /Pin to ProfileBookmark

Returning to reference page

Warning: Cannot modify header information – headers already sent by (output started at c:program fileseasyphp1-8wwwnew foldergetreg.php:5) in c:program fileseasyphp1-8wwwnew foldergetreg.php on line 27

That is the error im getting when i try to send the user back to the referring page it worked for my log in screen but is causing trouble with registration.
Im just testing to see if it will work before i start querying the database with the registration. Thanks in advance

heres the html form

[code=html]<HTML>
<HEAD>
<meta HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=windows-1252″>
<meta http-equiv=”Content-Language” content=”en-us”>
<TITLE>New Page 2</TITLE>
</HEAD>
<BODY>
<h1>[Name of your sub site] User Registration</h1>

<hr>
<P>
<i>Please fill in the details below to register for the website</i></P>
<form action = “getreg.php” method = “POST”>
–><OL>
<LI>
<P>
Please provide your account information:</P>
<TABLE>
<TR>
<TD ALIGN=”right”>
<EM>User Name</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Account_Username” SIZE=16 MAXLENGTH=16>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>Password</EM></TD>
<TD>
<INPUT TYPE=PASSWORD NAME=”Account_Password” SIZE=16 MAXLENGTH=16>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>Confirm Password</EM></TD>
<TD>
<INPUT TYPE=PASSWORD NAME=”Account_PasswordConfirm” SIZE=16 MAXLENGTH=16>
</TD>
</TR>
</TABLE>
<p>&nbsp;<LI>
<P>
Please provide the following contact information:</P>
<TABLE>
<TR>
<TD ALIGN=”right”>
<EM>Name</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_FullName” SIZE=35>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>Address Line 1</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_StreetAddress” SIZE=35>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>Address Line 2 </EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_Address2″ SIZE=35>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>City</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_City” SIZE=35>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>State/Province</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_Province” SIZE=35>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>Country</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_Country” SIZE=14>
</TD>
</TR>
<TR>
<TD ALIGN=”right”>
<EM>E-mail</EM></TD>
<TD>
<INPUT TYPE=TEXT NAME=”Contact_Email” SIZE=25>
</TD>
</TR>
</TABLE>
</OL>
<INPUT TYPE=SUBMIT VALUE=”Submit Form” action = getreg.php>
<INPUT TYPE=RESET VALUE=”Reset Form”>
</FORM>
<HR>
<H5>
Author information goes here.<br>Copyright © 2003 [OrganizationName]. All rights reserved. <BR>
Revised:
</H5>
</BODY>
</HTML>[/code]

this is the php code

[code=php]<html><head><title>Registration Page</title></head>
<body>
<hr>
</body>
<?php

$Username = $_POST[‘Account_Username’];
$Password = $_POST[‘Account_Password’];
$confirmP = $_POST[‘Account_PasswordConfirm’];
$FullName = $_POST[‘Contact_FullName’];
$Address1 = $_POST[‘Contact_StreetAddress’];
$Address2 = $_POST[‘Contact_Address2’];
$City = $_POST[‘Contact_City’];
$Province = $_POST[‘Contact_Province’];
$Country = $_POST[‘Contact_Country’];
$Email = $_POST[‘Contact_Email’];

$self = $_SERVER[‘PHP_SELF’];
$referer = $_SERVER[‘HTTP_REFERER’];

if($Password == $confirmP){
#submit details into database if the passwords match
echo(“The passwords matched”);
}
else{
#send back to registration with all fields still there except passwords
header(“Location:$referer”);
exit();
}
?></html>[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Sid3335Mar 02.2007 — you cannot output anything to the page before calling header()

put this:
<i>
</i>&lt;html&gt;&lt;head&gt;&lt;title&gt;Registration Page&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;hr&gt;
&lt;/body&gt;


after this:
[code=php]
if($Password == $confirmP){
[/code]
Copy linkTweet thisAlerts:
@Marcus_MaximusauthorMar 03.2007 — Makes sense. Thanks ?
×

Success!

Help @Marcus_Maximus 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 5.20,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...