Re: [PHP] Passing var from one page to itself

2008-12-25 Thread Aslan

Hi there,

Thanks so much everyone I really appreciate the help! I have it working 
now using hidden tags from each page to the next.

www.adslgeek.com/troubleshooter

Merry Christmas!
Cheers
Aslan

tedd wrote:

At 4:10 PM +1300 12/21/08, Aslan wrote:

Hey there,

I have a problem where I have a simple -script that I am  wanting to 
pass back to itself three times

1) Symptoms -  2) Troubleshooting questions 3) Answer to problem
-snip-

I have it currently all on one page, but it isn't quite what I was after
..
Any help would be appreciated!


Hi Aslan:

Keeping it all on one page (one script) is fine -- no problems with that.

Here's the technique I use.

$step = isset($__POST ['step']) ? $__POST ['step'] :1;

if($step == 1)
   {
   // do the first page stuff (Symptoms)
   // with a POST form that has an input type=hidden name=step 
value=1

   }

if($step == 2)
   {
   // do the second page stuff ( Troubleshooting questions)
   // with a POST form that has an input type=hidden name=step 
value=2

   }

if($step == 3)
   {
   // do the third page stuff (Answer to problem)
   // with a POST form that has an input type=hidden name=step 
value=3

   }

If you want to pass variables between pages (trips from client to the 
server nad back again), you have four options, namely: 1) 
writing/reading a file; 2) writing/reading a database entry; 3) 
passing via a POST/GET; 4) or using SESSIONS.


For most things, I prefer using POST/GET and/or SESSIONS. Try this format:

$var1 = isset($_POST['var1']) ? $_POST['var1'] : null;
$var2 = isset($_SESSION['var2']) ? $_SESSION['var2'] : null;

That's the way I pass data between client and server.

However, what you are describing sounds a bit like this:

http://webbytedd.com/b/exam/

With this example, I'm not passing anything to the server -- 
everything is kept client-side and is quick.


If interested, all the code is there.

Cheers,

tedd

--
  
---

http://sperling.com  http://ancientstones.com  http://earthstones.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Passing var from one page to itself

2008-12-21 Thread kspal

hello,
you can use session to store your variables between pages.



Aslan a écrit :

Hey there,

I have a problem where I have a simple -script that I am  wanting to 
pass back to itself three times

1) Symptoms -  2) Troubleshooting questions 3) Answer to problem

The page is passing the vars from the first page to the second, but 
the first pages vars are not passed to the third (but the second page is)


I am using includes for each sectional page and passing it back to 
itself


   if($submitted == )
   {
include 'inc/tshoot2-input.php';
   }
   if($submitted == symptoms)
   {
include 'inc/tshoot2-symptoms.php'; }
   if($submitted == submitted)
   {
include 'inc/answers.php';   }

The tool will ultimately be on www.adslgeek.com/troubleshooter/

I have it currently all on one page, but it isn't quite what I was after
..
Any help would be appreciated!

Cheers
ADSL Geek



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Passing var from one page to itself

2008-12-21 Thread Jason Paschal
also, you can store info in hidden form fields.  on the 2nd page, populate
the hidden fields with the data from the first page.  when that form is
submitted, the hidden field values will get submitted as well.

that's not ideal, tho.  if you have validation in place between the first
and second pages, that could be obviated if someone who knew some stuff
changed the hidden field values before it gets sent to the 3rd page.

you could do the session vars as the previous person suggested, but if you
have a lot of data to store, you might want to consider putting it into a
database using the session_id as the identifier.

On Sun, Dec 21, 2008 at 3:10 AM, kspal i...@kspal.com wrote:

 hello,
 you can use session to store your variables between pages.



 Aslan a écrit :

  Hey there,

 I have a problem where I have a simple -script that I am  wanting to pass
 back to itself three times
 1) Symptoms -  2) Troubleshooting questions 3) Answer to problem

 The page is passing the vars from the first page to the second, but the
 first pages vars are not passed to the third (but the second page is)

 I am using includes for each sectional page and passing it back to
 itself

   if($submitted == )
   {
include 'inc/tshoot2-input.php';
   }
   if($submitted == symptoms)
   {
include 'inc/tshoot2-symptoms.php'; }
   if($submitted == submitted)
   {
include 'inc/answers.php';   }

 The tool will ultimately be on www.adslgeek.com/troubleshooter/

 I have it currently all on one page, but it isn't quite what I was after
 ..
 Any help would be appreciated!

 Cheers
 ADSL Geek


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Crunchmutt Studios
Latest News Headlines: http://www.rssvideonews.com
http://www.imagepoop.com
http://www.crunchmutt.com
http://www.deadjoe.com
http://www.dailymedication.com
http://www.extremesportclips.com
http://www.coolanimalclips.com
http://www.robotclips.com
http://www.newsfinger.com
http://www.postyourimage.com
http://www.nakedalarmclock.com


Re: [PHP] Passing var from one page to itself

2008-12-21 Thread tedd

At 4:10 PM +1300 12/21/08, Aslan wrote:

Hey there,

I have a problem where I have a simple -script that I am  wanting to 
pass back to itself three times

1) Symptoms -  2) Troubleshooting questions 3) Answer to problem

-snip-

I have it currently all on one page, but it isn't quite what I was after
..
Any help would be appreciated!


Hi Aslan:

Keeping it all on one page (one script) is fine -- no problems with that.

Here's the technique I use.

$step = isset($__POST ['step']) ? $__POST ['step'] :1;

if($step == 1)
   {
   // do the first page stuff (Symptoms)
   // with a POST form that has an input type=hidden name=step value=1
   }

if($step == 2)
   {
   // do the second page stuff ( Troubleshooting questions)
   // with a POST form that has an input type=hidden name=step value=2
   }

if($step == 3)
   {
   // do the third page stuff (Answer to problem)
   // with a POST form that has an input type=hidden name=step value=3
   }

If you want to pass variables between pages (trips from client to the 
server nad back again), you have four options, namely: 1) 
writing/reading a file; 2) writing/reading a database entry; 3) 
passing via a POST/GET; 4) or using SESSIONS.


For most things, I prefer using POST/GET and/or SESSIONS. Try this format:

$var1 = isset($_POST['var1']) ? $_POST['var1'] : null;
$var2 = isset($_SESSION['var2']) ? $_SESSION['var2'] : null;

That's the way I pass data between client and server.

However, what you are describing sounds a bit like this:

http://webbytedd.com/b/exam/

With this example, I'm not passing anything to the server -- 
everything is kept client-side and is quick.


If interested, all the code is there.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

[PHP] Passing var from one page to itself

2008-12-20 Thread Aslan

Hey there,

I have a problem where I have a simple -script that I am  wanting to 
pass back to itself three times

1) Symptoms -  2) Troubleshooting questions 3) Answer to problem

The page is passing the vars from the first page to the second, but the 
first pages vars are not passed to the third (but the second page is)


I am using includes for each sectional page and passing it back to itself

   if($submitted == )
   {
include 'inc/tshoot2-input.php';
   }
   if($submitted == symptoms)
   {
include 'inc/tshoot2-symptoms.php';  
   }

   if($submitted == submitted)
   {
include 'inc/answers.php';
   }


The tool will ultimately be on www.adslgeek.com/troubleshooter/

I have it currently all on one page, but it isn't quite what I was after
..
Any help would be appreciated!

Cheers
ADSL Geek

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php