Re: [PHP-DB] Lost data after space in PHP variables

2015-02-19 Thread Richard Quadling
On 17 February 2015 at 20:36, Charlie Lewis charlie.le...@honest-it.com
wrote:

 I'm not sure that this is entirely the group for my question, so apologise
 if it is.



 I'm losing data in variables that use the assignment of $_POST[]. Any
 variable with a space in the $_POST[] loses everything after the space. Is
 it that I need to enclose the data with ' or ? I've tried all that with
 little success.


Using a simple script like this ...

html
head
titleTesting spaces in names/title
/head
body
form method=POST action=?= $_SERVER['PHP_SELF'] ??a b=c d
input type=input name=e f value=g h
input type=submit
/form
pre?php
var_export($_GET);
var_export($_POST);
?/pre
/body
/html

results in ...



array (
  'a_b' = 'c d',
)array (
  'e_f' = 'g h',
)

So, your spaces are automatically converted to _ by PHP.

This is documented at
http://php.net/manual/en/language.variables.external.php


-- 
Richard Quadling


Re: [PHP-DB] Lost data after space in PHP variables

2015-02-18 Thread Bastien Koert
Generally input names shouldn't have spaces, use underscores if needed

On Tue Feb 17 2015 at 4:34:55 PM rahul bhola rb1223334...@gmail.com wrote:

 Can you post some code snippet here

 cheers
 Rahul



[PHP-DB] Lost data after space in PHP variables

2015-02-17 Thread Charlie Lewis
I'm not sure that this is entirely the group for my question, so apologise
if it is.

 

I'm losing data in variables that use the assignment of $_POST[]. Any
variable with a space in the $_POST[] loses everything after the space. Is
it that I need to enclose the data with ' or ? I've tried all that with
little success.

 

Thank-you.

 

Charlie

 

 

 



Re: [PHP-DB] Lost data after space in PHP variables

2015-02-17 Thread rahul bhola
Can you post some code snippet here

cheers
Rahul