How can I get a user variable from another php page without $ _SESSION?

0

I have two php pages in one I have a form and I want to take the email variable from the other page. Like I do without using $ _SESSION. I want to do this because from the server it does not work for me to use $ _SESSION or start_session ()

<header class='main' id='h1'>
  <span class="right"><a href='../HTML5/layout.html'>LogOut</a> </span>
  <span> Usuario: <?php echo "$_GET[email]"; ?> </span>
  <h2>Quiz: crazy questions</h2>
</header>

This does not work for me

    
asked by UnaiLopez 14.11.2017 в 22:48
source

2 answers

0

If I did not understand what you want to do, if you already have the variable in another page .php you could pass the variable process a form with POST method:

<form class="" action="(url pagina de destino de los datos)" method="POST">
   <input type="hidden" name="e-mail" value="[email protected]">
   <input type="submit" value="enviar">
</form>

instead if the user has to insert it:

<form class="" action="(url pagina de destino de los datos)" method="POST">
   <input type="email" name="e-mail">
   <input type="submit" value="enviar">
</form>

and on the page you receive it (the one you put in the action):

<?php 
   $mail = $_POST['e-mail'];
?>

I hope I can help you with something

    
answered by 14.11.2017 / 23:14
source
0

At the top of your code you should add with a include in this way to make the call of another file PHP that contains what is the connection or the call to the variables and in this way you can use the $GET_[email] without problems, then I leave it as you must include the file that contains the connection or the interaction with the database:

<?php
include('conectar.php');    
$linkt=conectar();
extract($_GET);
?>
   <header class='main' id='h1'>
     <span class="right"><a href='../HTML5/layout.html'>LogOut</a> </span>
     <span> Usuario: <?php echo "$_GET[email]"; ?> </span>
       <h2>Quiz: crazy questions
       </h2>
   </header>  
<?php
mysqli_close($linkt);
?>
<br />  

where $linkt is the connection to your database and extract($GET); to get the variables that come from the other file.

    
answered by 14.11.2017 в 23:00