Kristoff1875 Posted May 28, 2012 Share Posted May 28, 2012 I've currently, after some great help from Barand, got a remote XML that I grab values from, but now I am having an issue storing them in to a PHP session and I keep getting errors? My values are being called as follows: $make = $xml->REQUEST->MB01->MAKE; <p><strong>Make:</strong> <? echo $make; ?></p> Which is working fine, but i've got the following: <?php session_start(); session_register('make'); $_SESSION['make'] = $make]; ?> Which is giving out the following error: Warning: session_start() [function.session-start]: Node no longer exists in page.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at page.php on line 2 Warning: Unknown: Node no longer exists in Unknown on line 0 Any ideas what's up?! Thanks in advance! EDIT: There are currently no header functions in the coding. Quote Link to comment https://forums.phpfreaks.com/topic/263262-storing-xml-values-in-to-php-session-variables/ Share on other sites More sharing options...
Barand Posted May 28, 2012 Share Posted May 28, 2012 Use $_SESSION[] = xxx and not session_register(). session_register() is deprecated, along with register_globals (out of favour for years now). Do you have an old book? session_start() needs to right at the top of the page. Quote Link to comment https://forums.phpfreaks.com/topic/263262-storing-xml-values-in-to-php-session-variables/#findComment-1349178 Share on other sites More sharing options...
Kristoff1875 Posted May 28, 2012 Author Share Posted May 28, 2012 I didn't realise, but it seems I am referencing from old code looking at the comments below!! http://www.html-form-guide.com/php-form/php-order-form.html Quote Link to comment https://forums.phpfreaks.com/topic/263262-storing-xml-values-in-to-php-session-variables/#findComment-1349183 Share on other sites More sharing options...
Kristoff1875 Posted May 28, 2012 Author Share Posted May 28, 2012 Also needed to add (string) to the xml call, so for anyone who ever finds this on a search: $make = (string)$xml->REQUEST->MB01->MAKE; And then: session_start(); $_SESSION['make'] = $make; I'm assuming that is correct as it is echoing the variable correctly on the next page using: <? echo $_SESSION['make']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/263262-storing-xml-values-in-to-php-session-variables/#findComment-1349186 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.