PDA

View Full Version : xml gets error http header from php


wizmay
05-26-2006, 10:06 AM
Well, I'm not sure if I'm supposed to post this issue in the xml or php forum. Anyway, I create a php code to write an http header in order to create an xml document:

$line1 = "<?xml version=\"1.0\"?>";

then I use a form to send the above line to another php page in order to check if it's correct.

<form name="form1" method="POST" action="test.php">
<input type="hidden" name="passxml" value='<?=$line1?>'>
<input type="submit" value="Submit">
</form>

I got:

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------
A string literal was expected, but no opening quote character was found. Error processing resource 'http://localhost/apps...

<?xml version=\"1.0\"?>
--------------^


How come the php send the \" instead of only "? I tried using stripslashes() but still didn't work. However, when I wrote the $line1 to a text file, it came out correctly (<?xml version="1.0"?>). :confused:

jskaar
05-26-2006, 01:49 PM
Perhaps you could try
$line1 = '<?xml version="1.0"?>';