Jump to content

Recommended Posts

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>

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?

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
	}

?>

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.