mercredi 9 août 2017

send variables through header() php

I'm trying to send variable through header() function from page1.php to page2.php

this is in page1.php:

$id = $row['id'];                     
header("Location: index.php?vals=" . urlencode(serialize($id)));

and this is in page2.php

if($_GET['vals'])//to take the id
      {
          $id= unserialize(urldecode($_GET['vals']));
//other code
}

But I can't use $id in second page and get this error

domain.tech is currently unable to handle this request. HTTP ERROR 500

Aucun commentaire:

Enregistrer un commentaire