/    Sign up×
Community /Pin to ProfileBookmark

problem with header

<?

if ($_POST[“name”])

{

$kind = ” 1111 Co”;

$name=htmlspecialchars($_POST[‘name’]);
$emal=htmlspecialchars($_
POST[’emal’]);
$city=htmlspecialchars($_POST[‘city’]);
$country=htmlspecialchars($_
POST[‘country’]);
$tel=htmlspecialchars($_POST[‘tel’]);
/*echo $kind;
echo $name;
echo $emal;
echo $city;
echo $country;
echo $tel;*
/
?>

<?

$messageo = ‘

<html>
<head>
<style>

body {

font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #737373;
text-align: justify;
width: auto;
margin-right: 0px;
margin-left: 0px;
margin-top: 10px;
margin-bottom: 10px;
line-height: 17px;

}
.padding {
padding-left: 30px;
background-color: #cdcdcd;
color: #023061;
height: 30px;
vertical-align: middle;
}
.padding2 {
padding-left: 30px;
background-color: #E5E5E5;
color: #023061;
height: 30px;
}

.title1 {
font-size: 17px;
font-weight: bold;
color: #023061;
padding-top: 20px;
padding-bottom: 25px;
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
}

</style>

</head>
<body>
<div class=”title1″ align=”center”>Kay & Co</div>
<table width=”50%” border=”0″ cellspacing=”1″ cellpadding=”4″ align=”center”>
<tr class=”padding”>
<td width=”30%”><strong>Name <b></strong> </td>
<td >’ . $name . ‘</td>
</tr>

<tr class=”padding2″>
<td ><strong>E-mail </strong> </td>
<td >’ . $emal . ‘</td>
</tr>

<tr class=”padding”>
<td><strong> City </strong> </td>
<td>’ .$city . ‘</td>
</tr>
<tr class=”padding2″>
<td><strong>Country</strong> </td>
<td>’.$country.'</td>
</tr>
<tr class=”padding”>
<td><strong>Telephone</strong> </td>
<td>’ . $tel.'</td>
</tr>
</table>

</body>
</html> ‘;

$headers .= “MIME-Version: 1.0rn”;
$headers .= “Content-type: text/html; charset=windows-1256rn”;
$headers .= “From: [email][email protected][/email]>rn”;
$headers .= “cc: [email][email protected][/email]rn”;

$ok = mail(“[email protected]”, $kind, $messageo, $headers);

}
[b] [COLOR=”Red”]header(“Location: welcome.php”);[/COLOR] [/b]

[COLOR=”red”]// here i got the error “cannot modify header information[/COLOR]

?>

[b]i have a problem wiz header here coz when i post data from a form to this page to send an e-mail , i force the page to go to welcome.php using header but it show me a message
” CANNOT MODIFY HEADER INFORMATION”
i treid to remove the <html><body >…. tags and it could not work correctly it shows the same message

[COLOR=”red”]and when i tried to put the header in the top of the code it did not work correctly on the server[/COLOR]
can anyone help me plz

[/b]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJan 11.2009 — You cannot send a header after you have echoed output. Headers can only be sent before any output is echoes because echoing sends a header automatically.

Also PLEASE use php tags when posting code, I was ready to just hit back like I do with most threads where the code is not formatted properly, I only posted because it was so quick to see the problem in this case.
×

Success!

Help @john_zakaria 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.25,
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,
)...