Re: Underscores in submitted form data
| From: | Catalin Trifu | Date: | Wed, 21 May 2003 13:06:14 +0000 |
| Subject: | Re: Underscores in submitted form data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148410@lists.php.net to get a copy of this message | ||
Hi,
I think you mean you have a script which receives FORM data from the
client (the browser).
if you have a field in a form like this:
<INPUT type='text' name='field text'>
this would translate in PHP as $field text which is impossible, because
variable names can not have spaces
I think that the PHP engine automatically converts the spaces into
underscores, so that you get a variable:
$field_text which is a legal PHP variable.
If you call phpinfo(INFO_VARIABLES); you will see that the $_GET
contains
$_GET['field_text'] = 'what ever value sent back';
and that the
$_SERVER["argv"] = Array (
[0] => field
[1] => text='what ever
value sent back'
)
The idea is you shout not use spaces in form input names, or anything
that can be transformed in a variable by PHP.
Hope this helps,
Catalin
"Patrick Schnegg" <info@killersushi.ch> wrote in message
news:20030521125027.45363.qmail@pb1.pair.com...
> Hi
>
> I have a script that submits form data to the client. It works fine, but
> spaces in field names are submitted as underscores. Why is that? Do I need
> to post the script?
>
> Greetings
> Patrick
>
>