How to destroy php session with one button

I would like to make a simple form button that completely destroys the session when you click on it. I am just starting to use PHP for the first time and cannot see how I implement it in my HTML code.

I want just a form button that will clear the session (and maybe an explanation of how it works)

+3
source share
1 answer

A form button is like any other form button, nothing special. Catch the POST on the php side of things and use session_destroy (); completely kill session data.

. , : http://www.tizag.com/phpT/postget.php http://www.tizag.com/phpT/phpsessions.php

PHP , : http://www.tizag.com/phpT/forms.php

:

Order.html:

<html><body>
<h4>Tizag Art Supply Order Form</h4>
<form action="process.php" method="post">
<input type="submit" />
</form>
</body></html>

process.php:

<html><body>
<?php
session_destroy();
?>
</body></html>

... ?

+12

Source: https://habr.com/ru/post/1751646/


All Articles