简体   繁体   中英

Update SESSION variables when form is submitted

I have a form in account.php that is prefilled with the user's current info but can be changed and then when you submit, it updates the database. However, when returned to the page after the update, the prefilled text is not updated. It only updates if you re-log in. At this point I have only messed with updating the username.

An little example for updating a session var. I hope this helps:

<?php
session_start();

// database update or whatever

$_SESSION['username'] = $newUserName;

//Something else

?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM