Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 117,541 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 1,665 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



I need help with passing variables from 1 page to another

 
Reply to this topicStart new topic

I need help with passing variables from 1 page to another

Eltrusko
post 10 May, 2008 - 02:26 AM
Post #1


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 4

How to USE source code(browser generated output)with value of variable using "function highlight_file($file, TRUE);" of a php file so that i can convert it into a html file or text file and able to upload that html file to Server..


Actually file setup is like that......

"page1.php" passes variable with value to "page2.php" and page3.php contains

CODE

<?php
$contents = file_get_contents('http://localhost/test/page2.php');
$fp = fopen('tmp.txt','r+');
fwrite($fp,$contents);
fclose($fp);
highlight_file('tmp.txt');
?>


when i trigger an event(submit) on page2.php then only page3.php will be executed...
everything is goin on fine....except that value of the varibale........
somebody told me the problem not the solution .......


He told me:-" post variables are generated at run time when a form from a page move towards to next page that have $_POST[] variables so that it may have values but as u are not forwarding and using it directly how will they get the values ??"

So, what should i do & where i have to make changes? plz reply........

** Edit ** code.gif
User is offlineProfile CardPM

Go to the top of the page


no2pencil
post 10 May, 2008 - 09:30 PM
Post #2


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 5,421



Thanked 35 times

Dream Kudos: 2350

Expert In: Goofing Off

My Contributions


Here is a Tutorial on using $_GET & $_POST to pass & gather information from one page to another.

QUOTE

when i trigger an event(submit) on page2.php then only page3.php will be executed...
everything is goin on fine....except that value of the varibale........
somebody told me the problem not the solution .......

Could you elaborate? If I do understand this correctly, you are trying to use a variable that you set on page1.php, however it does not have a value on page2.php. You would need to pass it, either with $_GET or $_POST, or create a session, so that all session variables are available, & you would not have to pass them from page to page.

Here is a Tutorial on sessions in PHP, & here & here are two great Snippets that explain sessions usage in PHP.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 05:20PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month