unemployment Posted August 2, 2011 Share Posted August 2, 2011 After my users register I am trying to load my lightbox to tell them to go and activate their account, but my lightbox won't load after header location. How can I achieve this? <?php header("location: index.php"); ?> <script type="text/javascript"> lightbox.show('Success!', function(body){ body.appendChild(document.createTextNode('You have registered successfully! Please check your email <?php echo $u_info['email']; ?> to activate your account.')); }); </script> Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/ Share on other sites More sharing options...
Zane Posted August 2, 2011 Share Posted August 2, 2011 You can't output anything after a redirect, it's completely illogical. It's like sending someone to the store and then after they're gone, pulling out the needed money. Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1250821 Share on other sites More sharing options...
unemployment Posted August 2, 2011 Author Share Posted August 2, 2011 You can't output anything after a redirect, it's completely illogical. It's like sending someone to the store and then after they're gone, pulling out the needed money. So it sounds like your saying that I need to play the javascript in index.php? How can I tell the script to load only when someone complete the registration after the redirect? Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1250822 Share on other sites More sharing options...
Zane Posted August 2, 2011 Share Posted August 2, 2011 can you show the whole code. I can't decipher what you're doing from the code you provided. Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1250824 Share on other sites More sharing options...
unemployment Posted August 2, 2011 Author Share Posted August 2, 2011 can you show the whole code. I can't decipher what you're doing from the code you provided. The full code would be very long but here is a bigger snippet. I made a registration page and after the third step I want users redirected back to the index where my lightbox would load telling them to check their email. I wan't to do this rather than have a thank you page. <?php $sql = "UPDATE `users` SET `country` = '${country}', `state` = '${state}', `city` = '${city}', `personalweb` = '${personalweb}', `dateofbirth` = '${dateofbirth}', `gender` = '${gender}', `signupdate` = NOW() WHERE `id` = ${id}"; mysql_query($sql) or die("User insert error: ".mysql_error()); if((isset($accounttype)) && ($accounttype == 0)) { $sql2 = "INSERT INTO `investor_info`(`uid`, `accredited`) VALUES('${id}', '${accredited}')"; mysql_query($sql2) or die("User insert error: ".mysql_error()); } $_SESSION["uid"] = $id; $u_info = fetch_user_info_reg($id); $invbody = str_replace(array('<[fname]>', '<[id]>', '<[code]>'), array($u_info['firstname'], $u_info['id'], $u_info['code']), $invbody); mail($u_info['email'], 'Activate Your Account', $invbody, 'From: Prymd <noreply@prymd.com>'); //deactivate_beta_key($_GET["key"], $id); header("location: index.php"); ?> <script type="text/javascript"> lightbox.show('Success!', function(body){ body.appendChild(document.createTextNode('You have registered successfully! Please check your email <?php echo $u_info['email']; ?> to activate your account.')); }); </script> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1250830 Share on other sites More sharing options...
Zane Posted August 2, 2011 Share Posted August 2, 2011 Why not just display the lightbox on the registration page and use document.location to redirect on close of the lightbox..? Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1250838 Share on other sites More sharing options...
unemployment Posted August 2, 2011 Author Share Posted August 2, 2011 Why not just display the lightbox on the registration page and use document.location to redirect on close of the lightbox..? I suppose I could do that. Maybe that's what i'll do. Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1250840 Share on other sites More sharing options...
unemployment Posted August 3, 2011 Author Share Posted August 3, 2011 Why not just display the lightbox on the registration page and use document.location to redirect on close of the lightbox..? I suppose I could do that. Maybe that's what i'll do. I've decided against it. I want the lightbox to load on the index after the redirect. Is there anyway to do this effectively? Quote Link to comment https://forums.phpfreaks.com/topic/243621-make-lightbox-appear-after-header-location/#findComment-1251361 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.