I'm doing a form in more page on joomla.
I'd like to do a thing
The user log-in the site. Complete the first page of the form, after when insert the data e click on a button I will be redirect to another page of the form
I tried this code
$user = JFactory::getUser();
$id = $user->get('id');
if(isset($_SESSION['id']))
{
header("Location: http://www.mysite/second-page-form");
exit;
}
But it doesn't work
I can solve it?
Try the following, it will set the location
header of the response to the location of your second page:
if($user->id)
{
header("Location: http://www.mysite/second-page-form");
exit;
}
You do not need to check for the session. You can simply detect if the user is logged in:
$user = JFactory::getUser();
$app = JFactory::getApplication();
if(!$user->guest)
{
$app->redirect(JRoute::_('URL GOES HERE STARTING WITH index.php'), false);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.