Jump to content

Storing XML values in to PHP session variables?


Kristoff1875

Recommended Posts

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.

Link to comment
Share on other sites

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']; ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.