/    Sign up×
Community /Pin to ProfileBookmark

Resetting a page

I have a page that is partially populated dynamically by PHP. Because of this the standart hmtl reset button doesn’t work. A standard javascript won’t work either because I have session values from the PHP scripts.

Is there a way to have a user click the reset button and then use javascript to call a PHP page that will end the session and reload the page.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@toicontienNov 16.2007 — Try this HTML out:
[code=html]<input type="reset" name="reset_session" value="Reset">[/code]
When you click this button, a variable called "reset_session" will be in the $_POST or $_GET. In your PHP:
[code=php]if (isset($_POST['reset_session'])) {
// PHP code to delete the session
} else {
// Process the form submission normally
}[/code]

This would be in the same PHP file that the FORM's action attribute points to. No JavaScript needed.
Copy linkTweet thisAlerts:
@michaelh613authorNov 16.2007 — Try this HTML out:
[code=html]<input type="reset" name="reset_session" value="Reset">[/code]
When you click this button, a variable called "reset_session" will be in the $_POST or $_GET. In your PHP:
[code=php]if (isset($_POST['reset_session'])) {
// PHP code to delete the session
} else {
// Process the form submission normally
}[/code]

This would be in the same PHP file that the FORM's action attribute points to. No JavaScript needed.[/QUOTE]


I've been so focused on learning javascript forgot my html. Had to make one change to make the button submit instead of reset and then it works.

Thanks for not bonking me on the head
Copy linkTweet thisAlerts:
@toicontienNov 16.2007 — ? No problem. I've had the same thing happen.
×

Success!

Help @michaelh613 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.18,
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,
)...