hmdnawaz Posted December 31, 2010 Share Posted December 31, 2010 I have two pages of php. one is page1.php and the other is page2.php. In page1.php there is a function which dynamically creates a form of html and return the full form at the end of the function. And I want to the function to return a 2nd variable with the form. and i get that variable on page2.php. How can i do this??? Quote Link to comment Share on other sites More sharing options...
tqla Posted December 31, 2010 Share Posted December 31, 2010 Read up on sessions here: http://www.tizag.com/phpT/phpsessions.php Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 31, 2010 Share Posted December 31, 2010 In order to have a function return more than one value you need to return the values in an array and then get the returned values from the array: <?php function twovals() { $firstval = 'This is the first value'; $second = 'This is the second value'; return (array($firstval,$second)); } list($val1,$val2) = twovals(); echo '$val1: ' . $val1 . ' --- $val2: ' . $val2; ?> Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.