ryanmetzler3 Posted January 17, 2014 Share Posted January 17, 2014 I have a comment section on my website. It requires your name, email, and comment. You can opt to login and then you do not have to fill in your name and email. My form looks like this: <tr> <td><label for="name">Name:</label></td> <input type="submit" id="loginbtn" value="Or Login" onclick="window.location='/login_scripts/login.php'" /></td> </tr> <tr> <td><label for="name">Email:</label></td> <td><input type="email" name="email" id='email'/></td> </tr> Once you login, the name and email fields disappear and you can just comment. I grab your user name from the database and insert that as your comment name. Anyways, how can I redirect them back to the comment section after they have been logged in? assuming they arrived at the login page from this specific login button... Link to comment https://forums.phpfreaks.com/topic/285455-redirect-back-to-original-page/ Share on other sites More sharing options...
davidannis Posted January 18, 2014 Share Posted January 18, 2014 After they login use the header() to redirect: header ('Location: http://mydomain.com/myprogram.php#mycommentanchortag'); Note: you need to use the header before any other output to the browser. Link to comment https://forums.phpfreaks.com/topic/285455-redirect-back-to-original-page/#findComment-1465636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.