Thanks for your help, matto!
I think i've sorteds this one out, you're right about my browser confusing things. Also, i dont think i explained the question very well. What i mean, is that the XML must be hidden, i'm using the XML as a kind of control field to pass information between sucessive posts to the same PHP page. When i put 'raw' XML into the value of the hidden field, my browser was displaying the XML (minus the tags, as you said) which i dont want it to. The answer is to URL encode the output, then urldecode the input. Here is some test code to illustrate:
<?php
/**
*This page to test is a bunch of XML can be posted to a server from a hidden form
*field (please, let it be!)
*/
?>
<html>
<head><title>XML posting test - will it work!</title>
</head>
<body>
<?php
echo echo_post_vars();
$xmlval = urlencode("<consultants><consultant cons_id=\"220\"><specialty>Accident and Emergency</specialty>
<title>Dr</title><fnames>Robin</fnames><snames>Harvey</snames><sex>M</sex>
<quals>FRCSEd(A&E),FFAEM</quals><year_qual>1986</year_qual><where_qual>UWI</where_qual>
<e_mail>rcbasie@netscape.net</e_mail></consultant></consultants>");
?>
<p>Click the button below to post, the post variables will be echoed out to your browser
</p>
<form action="xmlposttest.php" method="post">
<input type="hidden" name="xmlpoststuff" value="<?php echo $xmlval ?>" />
<input type="hidden" name="test" value="test">
<input type="submit" />
</form>
</body>
</html>
<?php
/**
*This is a test function to echo out the recieved post vars.
*/
function echo_post_vars()
{
if (is_array($_POST)) {
foreach($_POST as $key => $value) {
echo "<i>$key = " . urldecode($value) ."</i><br>";
}
}
else {
echo "<i>\$_POST = $_POST<br></i>";
}
}
?>
When i post to this page, the call to echo_post_vars() echoes out the XML exactly as i want it, albeit with the tags removed. By looking at the source, i can tell that the PHP page on the server is getting the XML as i intended it from the URL encoded source.
thanks once again for your help
Robin