Passing data between .php files

0

can you help me in a doubt I have a file called a.php and another b.php I need to pass a lot of data from the a.php file to the b.php file I'm doing it with the GET method as follows:

But the URL bar becomes excessively full

Does anyone know a more effective method?

    
asked by Javier 07.04.2018 в 04:27
source

1 answer

1

Sessions link

at the beginning of a.php:

<?php 
session_start();
// http://php.net/manual/es/function.session-start.php

$_SESSION['datosAEnviar'] = '';

and replace the get in the header location with these lines

$_SESSION['datosAEnviar'] = $Datos_comentarios; 
header("location:b.php");

then at the beginning of b.php

<?php 
session_start();
$Datos_comentarios = 
   isset($_SESSION['datosAEnviar']) ? $_SESSION['datosAEnviar'] : 'NoHayDatos';
/*  
    a partir de este momento $Datos_comentarios contiene lo que enviaste 
    o el texto "NoHayDatos" 
*/

at the end of the process in b.php you destroy the data and the session

unset($_SESSION['datosAEnviar']);
session_destroy();
    
answered by 07.04.2018 / 05:50
source