Forum Moderators: coopster

Message Too Old, No Replies

passing data to next page , not posting in url

post data to another page (windows)

         

NL_Cartman

11:49 pm on Sep 27, 2003 (gmt 0)

10+ Year Member



Hi again,

I want to use $var's generated in page1.php, in page2.php.

i've seen a linux command that uses "shared memory", is there one for windows too?

jatar_k

3:20 am on Sep 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could use sessions

PHP Session handling functions [ca.php.net]

NL_Cartman

9:19 am on Sep 28, 2003 (gmt 0)

10+ Year Member



Yes that would work, but then i still need to send var's via url's, or store them in cookies/files.

But since one can pass data from a form to another page, via $_POST/Submit, ime sure it must be possible to transfer $var's!

Or ame i just Dreaming?

Nick_W

9:27 am on Sep 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




<form method="post" action="nextpage.php">
<input type="hidden" name="var" value="<?=$var;?>" />
</form>

Like that?

Ooops! -> rather asuming you could use a link to submit it of course (bit early for me... ;))

Nick

NL_Cartman

9:50 am on Sep 28, 2003 (gmt 0)

10+ Year Member



Hi Nick,

Thats the method ime using now, so i guess, there's no other (cleaner) sollution?

Thanx Again!, & Again :)

daisho

1:04 am on Sep 29, 2003 (gmt 0)

10+ Year Member



<?
session_start();

$_SESSION['myvar']='this will carry';
?>

Make sure you have session_start(); at the top of every script.

Then you can read/write the $_SESSION array as if it were persistant between calls (because it is).

daisho.

NL_Cartman

6:10 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



this looks like a clean sollution indeed! :)

thanx aGain Daisho.

would You know if it's possible to process something like this:

if ( $varx < ($vary-2) ) { } , i've tried different (()) positions?

daisho

6:32 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



That looks right to me.

$varx=10;
$vary=20;

if ( $varx < ($vary-2) ) {
echo "$varx is smaller";
}

This would hit the echo statemement. If you set $vary=10; it would not hit the statement.

What issue are you having? Can you confirm that both vars are number variables.

daisho.

NL_Cartman

8:19 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



The issue is me writing too many code at once, before testing (ime a newbie to php, if not obvious ;) ).

the line was working, but did not get echo'd because i messed up the (last) echo line some 20 lines of code before it: echo "lets be stupid<br" ; took me a long time to See it.

My Xcuses :S , ThanX

daisho

8:42 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



That happens to the best of use. Typo's will forever be your enemy. I sure every seasoned programer here can tell you about 6 hours into a mind blowing problem it turned out to be a simple typo.

daisho.

jatar_k

9:00 pm on Sep 29, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am stuck in the middle of one now that has been going on for a day and a half.

It won't change when you get more proficient NL_Cartman, sometimes I think it gets worse.

NL_Cartman

9:53 am on Oct 9, 2003 (gmt 0)

10+ Year Member



thanx for the mental support Guy'Z :)

Greetings From Holland!