0

I am able to refresh a page using normal PHP. How do I do this with CodeIgniter?

I was trying this in PHP:

<html>
<title>Thank You</title>
<body bgcolor="#E6E6FA">
  <center>
    <h1>Thank You For Visiting...Wish you to visit again...</h1>
  </center>
  <?php
    header(refresh:5; url="login_input.php");
  ?>
</body>
</html>

I know to I have to write this:

"<?php echo base_url();?>index.php/welcome/"

But where?

Do I have to create functions in model and controller to do this?

Tobia Tesan
  • 1,938
  • 17
  • 29
Bumbu
  • 3
  • 3
  • 2
    The header function can only be utilized prior to loading ANY content on a page. So your original script should not even work. That said, codeigniter has a great `redirect` function https://ellislab.com/codeigniter/user-guide/helpers/url_helper.html – CollinD Sep 27 '15 at 07:36
  • In the name of all that's holy get rid of those `

    etc`
    – Tobia Tesan Sep 27 '15 at 07:39
  • @CollinD: my guess is that it works because of some caching server-side that delays the sending of the actual content. – Tobia Tesan Sep 27 '15 at 07:40
  • 1
    Oh yes, there are plenty of reasons that could work depending on PHP/webserver settings. But it's just really really bad practice, I suppose. – CollinD Sep 27 '15 at 07:41
  • 1
    You can't use PHP to perform the re-direct if you wish to display page content, instead use PHP to generate the re-direct URL (If required) and use a HTML re-direct: http://stackoverflow.com/questions/5411538/redirect-from-an-html-page – Dan Belden Sep 27 '15 at 07:41
  • @CollinD docs can be found here now at codeigniter main website https://codeigniter.com/docs Both versions –  Sep 27 '15 at 07:43
  • Oh fancy that. Thanks wolfgang good to know! – CollinD Sep 27 '15 at 07:44

1 Answers1

0

Thank you everyone for replying...And many thanks to Mr. Dan Belden for providing the link to gather knowledge.

Actually the desired code which I was looking for is as follows...

<html>
<title>Thank You</title>
<head>
<meta HTTP-EQUIV="REFRESH" content="5; url=<?php echo    
base_url();?>index.php/welcome/login">
</head>
<body bgcolor="#E6E6FA">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<center><h1>Thank You For Visiting...Wish you to visit again.......  
</h1></center>
</body>
</html>
Bumbu
  • 3
  • 3