Miks Posted November 9, 2009 Share Posted November 9, 2009 i wont open a new thread but i have a question about redirecting.... i wonder why my code doesnt redirect me... ....... foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {header("Location: http://www.mypage.com");} } ........... :confused: Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/ Share on other sites More sharing options...
Daniel0 Posted November 9, 2009 Share Posted November 9, 2009 If I were to make a guess, I would say it's because it's never the case that both $req == '1' and $value == '' evaluate to true at the same time. Without proving more info, it's difficult making a better guess than that. Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/#findComment-954449 Share on other sites More sharing options...
Miks Posted November 9, 2009 Author Share Posted November 9, 2009 $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') THEN I PUT HERE MY REDIRECT CODE ...and on the code goes $j = strlen($key); if ($j >= 20) $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/#findComment-954450 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 $req hasn't been set that i can see. Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/#findComment-954452 Share on other sites More sharing options...
Miks Posted November 9, 2009 Author Share Posted November 9, 2009 $req hasn't been set that i can see. oh sorry i havent written that but i set it with the rest of thoes parameters above. $req is set -> $req = '1' Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/#findComment-954459 Share on other sites More sharing options...
Miks Posted November 11, 2009 Author Share Posted November 11, 2009 anyone with some kind of explanation? Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/#findComment-955553 Share on other sites More sharing options...
PFMaBiSmAd Posted November 11, 2009 Share Posted November 11, 2009 You haven't exactly provided any proof that the logic is operating on values that would cause it to be redirecting. Are you sure that $value is ever an empty string? Are you developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php would display all the errors it finds, like a header error that would prevent the redirect from working? Quote Link to comment https://forums.phpfreaks.com/topic/180915-php-redirecting/#findComment-955555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.