Re: Plus sign changing to space in html form
| From: | Phoebe Bright | Date: | Thu, 31 Oct 2002 11:46:50 +0000 |
| Subject: | Re: Plus sign changing to space in html form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122235@lists.php.net to get a copy of this message | ||
Here is a fudge that uses Javascript to convert the + into {PLUS} then PHP converts it back again. The only problem is Javascript is only converting the first +, so a+b+c becomes a+b c.
<?php
$testVal=str_replace("{PLUS}","+",$_POST['test']);
echo $testVal;
php?>
<script>
function SaveHiddenChars() {
document.form1.test.value=document.form1.test.value.replace("+","{PLUS}");
}
</script>
<form name="form1" actiom='test.php' method=POST onSubmit="SaveHiddenChars();">
<input type=text value='' name=test>
<input type=submit value='submit'>
</form>
Stan wrote:
When i post a string containing plus sign with htmp form to a php scritp, the '+' is changed to space. e.g: i enter 'as+df' to a text input but $_POST[] returns 'as df' instead. It must be in php or apache configuration bcause i have this problem only on sytem with FreeBSD. On windows it works as expected. Know someone how could i make the '+' left intact? Please help. <? echo $_POST['test']; ?> <form actiom='test.php' method=POST> <input type=text value='' name=test> <input type=submit value='submit'> </form>