Mutley Posted December 2, 2008 Share Posted December 2, 2008 <script language='javascript'> var name = confirm("Are you sure you wish to purchase a <?=$conMan?> <?=$conNam?>?"); if(name==true) { window.location.href='shop.php?prod_id=<?=$prod_id?>&confirm=1'; } else { window.location.href=''; } </script> <? } if(isset($_GET['prod_id']) && $_GET['confirm']==1) { The last IF statement won't pass when it redirects, I honestly can't figure out why! Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/ Share on other sites More sharing options...
rhodesa Posted December 2, 2008 Share Posted December 2, 2008 what are you trying to accomplish with this: window.location.href=''; Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704190 Share on other sites More sharing options...
Mutley Posted December 2, 2008 Author Share Posted December 2, 2008 It doesn't redirect everywhere if untrue. But when it is true, it does redirect with the prod_id and confirm variables but doesn't initiate the next IF statement. Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704193 Share on other sites More sharing options...
DeanWhitehouse Posted December 2, 2008 Share Posted December 2, 2008 PHP help forum, not javascript. and window.location should be document.location = "website.com" Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704194 Share on other sites More sharing options...
Maq Posted December 2, 2008 Share Posted December 2, 2008 If it's true it redirects and that's it. Nothing else will be executed. Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704196 Share on other sites More sharing options...
Mutley Posted December 2, 2008 Author Share Posted December 2, 2008 If it's true it redirects and that's it. Nothing else will be executed. But if it's true, then it should go to the URL I put in with the $_GET attributes not the empty ELSE option...? Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704199 Share on other sites More sharing options...
DeanWhitehouse Posted December 2, 2008 Share Posted December 2, 2008 Is the url what you expect when redirected? Also what is in the if statement. Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704200 Share on other sites More sharing options...
rhodesa Posted December 2, 2008 Share Posted December 2, 2008 is it redirecting, just not to where you expect? what is the URL in your browser after the redirect, and what SHOULD it be Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704209 Share on other sites More sharing options...
Maq Posted December 2, 2008 Share Posted December 2, 2008 If it's true it redirects and that's it. Nothing else will be executed. But if it's true, then it should go to the URL I put in with the $_GET attributes not the empty ELSE option...? I thought you said it was redirecting... But when it is true, it does redirect with the prod_id and confirm variables but doesn't initiate the next IF statement. Quote Link to comment https://forums.phpfreaks.com/topic/135206-why-doesnt-this-redirect-work/#findComment-704210 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.