faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 5 people (80%) answered Yes
Recently 4 of 5 people (80%) answered Yes

Entry

Is any way to pass a variable from one .php to another WITHOUT using require()? How?

Mar 20th, 2008 17:18
ha mo, Dawit Abraham, Rakesh Trivedi,


Use sessions, example ..
page1.php
<?
session_start();
$_SESSION['username'] = 'dawit';
?>
<p>
Go to <a href="page2.php?<?php echo strip_tags(SID); ?>">Page 2</a>.
</p>
page2.php
<?php
session_start();
echo $_SESSION['username']; // Will print 'dawit'
unset ($_SESSION['username']); // will remove the session variable
?>
For detailed info visit http://www.php.net/session
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com