Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.