/    Sign up×
Community /Pin to ProfileBookmark

Pulling Variables from Host

I have a script that allows for a user to pick preset images and put in text and they will then hit submit and it will send the variables through the URL and will show the completed graphic on the next page. The problem that I’m having is that the session variables don’t seem to update and come back from the host until I manually refresh the page. Is there anyway to do an automatic reload / refresh on the page when it loads or to bring the host variables to the client when the form loads?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@scragarApr 16.2007 — you can use the meta refresh tag to reload the page after it finishes loading, but you would properly have to use a simple if to decide if it is necessary to reload the page(after all if it just keep reloading and doesn't stop the user will eventually get annoyed).

[code=html]
<!-- reload as soon as the page loads -->
<meta http-equiv="refresh" content="0" />
[/code]
Copy linkTweet thisAlerts:
@aymelekauthorApr 16.2007 — How would I do an if statement for body onload? Is there a If body onload = true?
Copy linkTweet thisAlerts:
@scragarApr 16.2007 — you miss understood what I meant, what I meant to say was that if the page is going to be reloaded you should have a php script to only write out the meta refresh tag if this is the first time the page has been loaded, a simple cookie could evaluate this:

[code=php]if(!isset($_COOKIE['reload'])){ // if the cookie isn't set.
$_COOKIE['reload'] = 1; // default it.
}; // end if.
if($_COOKIE['reload'] == 1){ // if first visit.
$_COOKIE['reload']++; // update visit no.
echo '<meta http-equiv="refresh" content="0" />'; // write refresh
}else{ // 2nd visit
$_COOKIE['reload'] = 1; // reset visit no.
};[/code]

however if the user doesn't have cookies thing could get tricky...
×

Success!

Help @aymelek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...