php page1 --> below bit is pure html:
<form action="page2.php" method="post">
<input type="text" name="name" id="name">
-----------submit button, end form --etc.--------------
php page2 (and yes i have intended to stuff the text input from page1 into a hidden input in page2):
foreach($_REQUEST as $key=>$value)
{
$value = htmlspecialchars(strip_tags(stripslashes($value))); //attempt to cleanse the data before displaying
}
echo "<p><input type='hidden' id='name' name='name' value='".$_REQUEST['name']."'/>".$_REQUEST['name']."</p>";
The problem is that the output on page 2 is not producing w3 compliant html if the user enters input with quotes such as John O'Brien, the html becomes:
<p><input type='hidden' id='email' name='email' value='John O'Brien'/>John O'Brien</p>
I would also like to be able to produce w3 compliant html for any bad input data such as: j'o/h s"m,ith
Any help is appreciated!