You are here: Re: Problem with session variables « PHP Programming Language « IT news, forums, messages
Re: Problem with session variables

Posted by samudasu on 02/27/06 06:13

First of all, welcome to PHP. Before starting on sessions, i suggest
doing some more reading on variables "Chapter 12", and especially 12.9
for this particular script in the online edition of the PHP manual.
http://www.php.net/manual/en/language.variables.php

I'm not sure if you're learing from an old tutorial or book but there
have been several changes in the way PHP works compared to previous
versions. Here is one example.
When you check the value of langua after clicking on "<a
href="?langua=2">set langua=2</a>", you'll have to check it by doing
$_GET['langua'] instead of $langua.

Keep it simple when starting out.

page1.php............
<html>
<body>
send a variable to page2<br />
<a href="page2.php?color=blue">send blue</a><br />
<a href="page2.php?color=red">send red</a><br />
</body>
</html>

page2.php.............
<?php
session_start();
// assign color from page 1 into session
$_SESSION['current_color'] = $_GET['color'];
?>
<html>
<body>
<?php
print $_SESSION['current_color'];
}
?>
</body>
</html>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация