Jump to content

variable


pranshu82202

Recommended Posts

KIRA i know these GET and POST method...

But my question in little bit defferent...

 

Suppose I have a php page page1.php with following code :

 

<?php
$var ="Hello WOrld"
header('location : page2.php');

?>

 

 

ANd their is page 2 page2.php

 

<?php

echo $var;

?>

 

This is not working and i dont want to initiate a session on page1.php ..

 

What should i do >...

Link to comment
https://forums.phpfreaks.com/topic/245759-variable/#findComment-1262282
Share on other sites

@AyKay47 : I dont want to use a session because i am destroying the session at the end of  page1.php but i want to take $var much more ahead..

 

And i dont think that their is a way to destroy only some session...

As i will apply session_destroy() all running session will destroy.....

Link to comment
https://forums.phpfreaks.com/topic/245759-variable/#findComment-1262284
Share on other sites

use get or post to pass the variable from page one to page two - which you would clearly know if you did indeed know "these GET and POST methods".

//page1.php
<?php
$var ="Hello World"
header("location : page2.php?var=$var");
?>

//page2.php
<?php
$var=$_GET['var'];
echo $var;

?>

Link to comment
https://forums.phpfreaks.com/topic/245759-variable/#findComment-1262287
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.