Hi,
I have a page where a user fills in a form and hits submit. The page then submits to itself ($PHP_SELF) and the variable values from the form are inserted into another variable that also contains XML. This XML data with the appropriate values is then passed in the variable through a header redirect - ie: header(Location: xxx.php?xml=$xml");
THe data passes ok but in the recipient page I am egtting an XML error. If I view the source on that page I can see the XML and it appears to be correct.
here is the code I have:
//file 1 - index.php
<?php
if($submit){
$xml = '
<?xml version="1.0" ?>
<novo-xml>
<register>
<client-id>test</client-id>
<password>'.$username.'</password>
<user-id>'.$password.'</user-id>
<phone-num>'.$phone.'</phone-num>
<app-id>test</app-id>
<channel>I</channel>
<user-type>upgrade</user-type>
</register>
</novo-xml>';
$xml = urlencode($xml);
header("Location: xmldata.php?xmldata=$xml");
}
?>
<html>
<head>
<title>form</title>
</head>
<body>
<form name="form1" method="post" action="<?=$PHP_SELF;?>">
username <input name="username"><p>
password <input name="password"><p>
phone <input name="phone"><p>
<input type="submit" name="submit">
</form>
</body>
</html>
and here is the code I have in the next file
//file 2 - xmldata.php
<?php
header("Content-type: text/xml");
echo $xmldata;
?>
I need the XML to pass correctly to the 2nd page (I am testing this on my local server but eventually it will be sending the XML data to a 3rd party web site)
Thanks,
Martin