Welcome Guest, Not a member yet? Register   Sign In
How to refresh a page using redirect?
#1

[eluser]jeanel16[/eluser]
A while ago i just had a problem on the state which it will display if the subject clicked was read or not yet read... im done with that thanks to the research scientist here in the forum Big Grin

my next problem is that after i click on the subject i will only turn into READ state if i will click another subject on the database... i want to know how......


how to know if the link was clicked or not.. and how to redirect the page to itself at the same time it will be refreshed so that the READ result will automatically appear with out waiting for another click from the user....
#2

[eluser]gRoberts[/eluser]
You can use

Code:
redirect(current_url());


to redirect to the current page, however I don't think that will help you.

When the person clicks on the subject, I assume the page loads and sets the subject as READ.

After the subject is set to READ, what happens? Do you display the same list of "subjects", or do you display information about the clicked subject?
#3

[eluser]jeanel16[/eluser]
yes after the subject was set to READ it will still display the subjects the READ state is the only thing that will change..... i tried to put redirect(current_url()); but it just loads and loads the url specified, what i want is that whenever the user clicked on one of the subjects (because subject is a link) that is the time that it must be refreshed.... do i need to put a conditional statement? hmm.....
#4

[eluser]Learn CodeIgniter[/eluser]
Code:
redirect(current_url(), 'refresh');
#5

[eluser]jeanel16[/eluser]
does this () parenthesis is required..?
#6

[eluser]jeanel16[/eluser]
redirect(current_url(), 'refresh');

i used this in my view, but it just always refresh the page infinitely, it don't stop Sad
#7

[eluser]CroNiX[/eluser]
Sure, because you are telling it to. It loads the view, comes across the refresh to the same page, so it does...then it loads the view and starts over again.
#8

[eluser]jeanel16[/eluser]
but all i want is to refresh the page only when the user opened or clicked on the subject...
#9

[eluser]Uno*[/eluser]
The link for mark read in the page article (for example)= article/read/1

On the controller article:
Code:
pubblic function read($num_mark){
  //code for insert num_mark on db, send to model etc..
  redirect(article);
}
#10

[eluser]Beginers[/eluser]
You should do this.

Code:
redirect('Controllername/functioname','refresh');

do not use current_url() cuz everytime you call the views it will infinitely loop everytime the page is load.




Theme © iAndrew 2016 - Forum software by © MyBB