Skip to content

Instantly share code, notes, and snippets.

@ktquez
Last active June 18, 2023 19:27
Show Gist options
  • Save ktquez/cf2add45c1bbd153ed6f to your computer and use it in GitHub Desktop.
Save ktquez/cf2add45c1bbd153ed6f to your computer and use it in GitHub Desktop.
session_form_simple.php
<?php
session_start(); // inicia a sessão
if(isset($_SESSION['form'])){
$_SESSION['form'] = array_merge($_SESSION['form'], filter_input_array(INPUT_POST)); // se existir, ele unifica os arrays
}else{
$_SESSION['form'] = filter_input_array(INPUT_POST); // se não existir, ele inicializa
}
var_dump($_SESSION['form']); // dá uma saída de como está ficando o array na session (serve somente de exemplo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment