By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,158 Members | 917 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,158 IT Pros & Developers. It's quick & easy.

problem with header()

P: n/a
Hi.
I wrote form in html and script php for it (all in one file - index.php)

//index.php

//some if statements to set $dobry to true or false
....
//here is the if statement that isn't working properly
if($dobry==TRUE){
session_start();
$_SESSION['strona1']=base64_encode(serialize($_POST));
header("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/wyszukiwanie.php");
exit();
}
else{
header("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/bladdanych.php");
exit();
}
//and after is form in html

The problem is that $dobry is true and i'm not going to wyszukiwanie.php.
I'm getting blank page index.php
Could you tell me what am I doing wrong?

Thanks for help.
Leszek

Jun 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Leszek wrote:
Hi.
I wrote form in html and script php for it (all in one file - index.php)

//index.php

//some if statements to set $dobry to true or false
...
//here is the if statement that isn't working properly
if($dobry==TRUE){
session_start();
$_SESSION['strona1']=base64_encode(serialize($_POST));
header("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/wyszukiwanie.php"); exit();
}
else{
header("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/bladdanych.php"); exit();
}
//and after is form in html

The problem is that $dobry is true and i'm not going to wyszukiwanie.php.
I'm getting blank page index.php
Could you tell me what am I doing wrong?
Hi,

dobry means 'allright' in Polish, right?
It is one of the very few words I know in Polish. :-)

Anyway, if $dobry is the result of a boolean expression, you do not need to
compare it to TRUE.
Just use if in a conditional statement.

eg:
$dobry = (1 == 2);
// $dobry is false now

$dobry = (1 == 1);
// $dobry is true now

If you want to use $dobry, do it as follows:
if ($dobry){
// $dobry was true

} else {
// $dobry was false
}
Regards,
Erwin Moller


Thanks for help.
Leszek


Jun 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.