Click here to Skip to main content
15,895,799 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: How to force a page to post back from another page? Pin
Guffa31-Mar-07 4:37
Guffa31-Mar-07 4:37 
Questionphp page being loaded twice Pin
john3431-Mar-07 2:19
john3431-Mar-07 2:19 
AnswerRe: php page being loaded twice Pin
Bradml31-Mar-07 2:35
Bradml31-Mar-07 2:35 
AnswerRe: php page being loaded twice Pin
Bradml31-Mar-07 4:18
Bradml31-Mar-07 4:18 
GeneralRe: php page being loaded twice Pin
john3431-Mar-07 8:13
john3431-Mar-07 8:13 
GeneralRe: php page being loaded twice Pin
Bradml31-Mar-07 18:31
Bradml31-Mar-07 18:31 
GeneralRe: php page being loaded twice Pin
john341-Apr-07 3:44
john341-Apr-07 3:44 
GeneralRe: php page being loaded twice Pin
Bradml1-Apr-07 3:56
Bradml1-Apr-07 3:56 
That is no problem. The easiest way to do this in PHP is through session variables.

Basically it relies on cookies but stores the data on the server side. This is not a perfect way to do it but unless you use databases it is very good.

Here is the gist of it:

First Page:
<?php
//Same rules apply for cookies as headers. Nothing above the <?php tags

session_start(); //Start the session. This needs to be at the top of every page that uses the session data.

$_SESSION["example"] = "Hello World"; //Assign the "example" variable to the session array.

?>

<a href="secound_page.php">Click here to go the secound page.</a>
Secound Page:
<?php
//Same rules apply for cookies as headers. Nothing above the <?php tags

session_start();

echo $_SESSION["example"]; //If this works it should print "Hello World"

?>

You can find more out at: http://www.php.net/manual/en/ref.session.php[^]




Brad
Australian

- Captain See Sharp on "Religion"

any half intelligent person can come to the conclusion that pink unicorns do not exist.

Questionbinary data asp Pin
Nilesh Hapse30-Mar-07 23:53
Nilesh Hapse30-Mar-07 23:53 
AnswerRe: binary data asp Pin
Dmitry Khudorozhkov31-Mar-07 2:51
Dmitry Khudorozhkov31-Mar-07 2:51 
Questionvoice chat Pin
tempsh30-Mar-07 23:40
tempsh30-Mar-07 23:40 
AnswerRe: voice chat Pin
Dmitry Khudorozhkov31-Mar-07 2:45
Dmitry Khudorozhkov31-Mar-07 2:45 
QuestionHow to fix, "next, previous," to bottom of browser Pin
starri0030-Mar-07 21:40
starri0030-Mar-07 21:40 
QuestionMasterpage-Contentpage Data Sharing Pin
RickyD230-Mar-07 10:26
RickyD230-Mar-07 10:26 
AnswerRe: Masterpage-Contentpage Data Sharing Pin
Bradml30-Mar-07 13:15
Bradml30-Mar-07 13:15 
GeneralRe: Masterpage-Contentpage Data Sharing Pin
RickyD22-Apr-07 2:30
RickyD22-Apr-07 2:30 
AnswerRe: Masterpage-Contentpage Data Sharing Pin
DavidNohejl1-Apr-07 21:54
DavidNohejl1-Apr-07 21:54 
GeneralRe: Masterpage-Contentpage Data Sharing Pin
RickyD22-Apr-07 2:37
RickyD22-Apr-07 2:37 
QuestionJavascript obfuscator. Pin
sergeyv200230-Mar-07 8:28
sergeyv200230-Mar-07 8:28 
AnswerRe: Javascript obfuscator. Pin
Dmitry Khudorozhkov31-Mar-07 2:47
Dmitry Khudorozhkov31-Mar-07 2:47 
AnswerRe: Javascript obfuscator. Pin
Hesham Amin1-Apr-07 6:46
Hesham Amin1-Apr-07 6:46 
Questionsession error in php Pin
kumar bharat bhusanam30-Mar-07 5:37
kumar bharat bhusanam30-Mar-07 5:37 
AnswerRe: session error in php Pin
Bradml30-Mar-07 13:14
Bradml30-Mar-07 13:14 
QuestionAJAX File Upload Form Submission Pin
RedDragon2k30-Mar-07 5:31
RedDragon2k30-Mar-07 5:31 
AnswerRe: AJAX File Upload Form Submission Pin
Dmitry Khudorozhkov31-Mar-07 2:42
Dmitry Khudorozhkov31-Mar-07 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.