Hello,
I cannot $_post['value_to_be_posted'] value into a <form><input type="hidden" value="<? echo $_post['value_to_be_posted'] ?>"></form> in chrome but works in IE and ff.
Any ideas
Thanks Jean
Hello,
I cannot $_post['value_to_be_posted'] value into a <form><input type="hidden" value="<? echo $_post['value_to_be_posted'] ?>"></form> in chrome but works in IE and ff.
Any ideas
Thanks Jean
First: PHP is case sensitive, so it should be $_POST. Second: pay attention to the quotes - if your posted value has a " inside it, you'll have a problem.
This may be because of varying default method values for <form> elements. See here
Try using a specific <form method='POST'> and see whether it works better.
PHP won't care what browser is receiving the HTML it's generating. It'll spit out the same data for Chrome as it would for IE and FF. Most likely your POST value has one or more characters in it that are "breaking" the HTML of the page, and IE/FF are being a bit more forgiving than Chrome is. Try this:
<form action=... method="post">
<input type="hidden" name="fieldname" value="<?php htmlspecialchars($_POST['one']) ?>" />
</form>
Passing the insertable data through htmlspecialchars() will escape any HTML metacharacters, (the quote characters, the angle brackets, and ampersand: ' " < > &), and this will keep the inserted data from 'taking over' your form if any of those characters are present.