PHP page redirect

0 votes

I am working on a function where I want it to redirect to a file located in the same root folder. Is it possible? 

if (...) {
    // I am using echo here.
} else if ($_SESSION['qnum'] > 10) { 
    session_destroy();
    echo "Some error occured.";
    // Redirect to "user.php".
}

Can PHP make a redirect call after executing a function?

Jun 23 in PHP by narikkadan
• 10,840 points
26 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
0 answers

How to redirect a page using onclick event in php?

I tried this, but it didn't work: <input ...READ MORE

Jun 20 in PHP by Kithuzzz
• 320 points
5 views
0 votes
1 answer

How can we track Google Analytics on a redirection page with PHP?

Hello @kartik, Since the page that is sending ...READ MORE

answered Apr 29, 2020 in PHP by Niroj
• 82,720 points
349 views
0 votes
1 answer

How can I add PHP page to WordPress?

Hii @kartik, First, duplicate post.php or page.php in your theme folder. Rename the ...READ MORE

answered May 8, 2020 in PHP by Niroj
• 82,720 points
486 views
0 votes
1 answer

How to resolve the problem of losing a session after a redirect in PHP?

Hello @kartik, Carry out these usual checks: Make sure session_start(); is ...READ MORE

answered Aug 24, 2020 in PHP by Niroj
• 82,720 points
15,218 views
0 votes
1 answer

How to get current PHP page name?

Hello @kartik, You can use basename() and $_SERVER['PHP_SELF'] to get current page ...READ MORE

answered Aug 28, 2020 in PHP by Niroj
• 82,720 points
552 views
0 votes
1 answer

How do I make a redirect in PHP?

Hello @kartik, Use the header() function to send an HTTP Location header: header('Location: '.$newURL); Contrary to ...READ MORE

answered Sep 16, 2020 in PHP by Niroj
• 82,720 points
229 views
0 votes
0 answers

PHP header(Location: ...): Force URL change in address bar

I have a new webpage but the ...READ MORE

Jun 1 in PHP by Kichu
• 19,040 points
20 views
0 votes
0 answers

PHP generate file for download then redirect

I have a PHP app that creates ...READ MORE

Jun 20 in PHP by narikkadan
• 10,840 points
10 views
0 votes
1 answer

Simple question regarding PHP, Wordpress & Yoast SEO

the way the search engine displays your ...READ MORE

answered Feb 14 in Others by narikkadan
• 10,840 points
33 views
0 votes
1 answer

How to fix "Headers already sent" error in PHP

The functions that send and modify the ...READ MORE

answered Feb 17 in Others by Aditya
• 7,280 points
157 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP