I have a legacy database table that has spaces in the field names.
So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
Note that I have many tables like this and I'm generating the edits
programaticaly.
Jeff 9 11214
Jeff wrote:
I have a legacy database table that has spaces in the field names.
So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
What does enumerating the $_POST array say (the keys, that is)? I know
periods are replaced with underscores. So spaces may be replaced with
underscores as well.
Best regards,
--
Willem Bogaerts
Application smith
Kratz B.V. http://www.kratz.nl/
..oO(Jeff)
I have a legacy database table that has spaces in the field names.
So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
Such names are invalid:
| ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
| followed by any number of letters, digits ([0-9]), hyphens ("-"),
| underscores ("_"), colons (":"), and periods (".").
>on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
Fix the names.
Micha
On Sep 18, 10:24*am, Jeff <jeff@spam_me_not.comwrote:
* I have a legacy database table that has spaces in the field names.
* *So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
Note that I have many tables like this and I'm generating the edits
programaticaly.
* *Jeff
Can you not just put in a translator? IE for outgoing html forms,
replace the " " in the field with an underscore, then when reading the
form and putting information in the database, replace the "_" in the
field name with an underscore.
Bill H
On Sep 18, 8:02*pm, Bill H <b...@ts1000.uswrote:
On Sep 18, 10:24*am, Jeff <jeff@spam_me_not.comwrote:
* I have a legacy database table that has spaces in the field names.
* *So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
Note that I have many tables like this and I'm generating the edits
programaticaly.
* *Jeff
Can you not just put in a translator? IE for outgoing html forms,
replace the " " in the field with an underscore, then when reading the
form and putting information in the database, replace the "_" in the
field name with an underscore.
Bill H
Wouldn't you want to replace the "_" with a space?
Bill H wrote:
On Sep 18, 10:24 am, Jeff <jeff@spam_me_not.comwrote:
> I have a legacy database table that has spaces in the field names.
So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
Note that I have many tables like this and I'm generating the edits programaticaly.
Jeff
Can you not just put in a translator? IE for outgoing html forms,
replace the " " in the field with an underscore,
I used a "+" to replace the spaces in the forms and when building the
key for $_POST. I usually use underscores to replace spaces but I didn't
want to use it here as I wanted some symbol that I wouldn't see
otherwise, yet had some meaning.
I don't know what naming conventions Access users use, but these
tables have been driving me crazy. Field and table names are
uppercase and have spaces in them. Primary keys may or may not be there
and if they are they aren't autoincrement. Unfortunately, it's all
mission critical stuff.
Jeff
then when reading the
form and putting information in the database, replace the "_" in the
field name with an underscore.
Bill H
Jeff wrote:
Bill H wrote:
>On Sep 18, 10:24 am, Jeff <jeff@spam_me_not.comwrote:
>> I have a legacy database table that has spaces in the field names.
So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
That doesn't work, I never see the form element. How do I get around this?
Note that I have many tables like this and I'm generating the edits programaticaly.
Jeff
Can you not just put in a translator? IE for outgoing html forms, replace the " " in the field with an underscore,
I used a "+" to replace the spaces in the forms and when building the
key for $_POST. I usually use underscores to replace spaces but I didn't
want to use it here as I wanted some symbol that I wouldn't see
otherwise, yet had some meaning.
After further thought, it didn't seem like + was legal in a form
field name, so I went with the underscore.
Jeff
>
I don't know what naming conventions Access users use, but these
tables have been driving me crazy. Field and table names are
uppercase and have spaces in them. Primary keys may or may not be there
and if they are they aren't autoincrement. Unfortunately, it's all
mission critical stuff.
Jeff
then when reading the
>form and putting information in the database, replace the "_" in the field name with an underscore.
Bill H
*** Jeff escribió/wrote (Thu, 18 Sep 2008 10:24:56 -0400):
I have a legacy database table that has spaces in the field names.
So I have a form that looks like this:
<input type="text" name="name with space" value="some_value">
on the server I have:
$field_name = 'name with space';
$my_form_value = $_POST[$field_name];
If you print the contents of $_POST:
print_r($_POST);
You'll see the actual name:
Array
(
[name_with_space] =some_value
)
The reason is that PHP used to create a local variable for each form value
(now it's optional an deprecated) and you can't have a variable with spaces
on its name.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Michael Fesser:
.oO(Jeff)
<input type="text" name="name with space" value="some_value">
Such names are invalid:
| ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
| followed by any number of letters, digits ([0-9]), hyphens ("-"),
| underscores ("_"), colons (":"), and periods (".").
No, the value of the name attribute of the form element is declared as
CDATA, not as a NAME token, so pretty much anything goes, including
spaces.
But, as the FAQ says, PHP would convert these spaces to underscores. http://www.php.net/manual/en/faq.html.php
--
Jock
..oO(John Dunlop)
>Michael Fesser:
>.oO(Jeff)
><input type="text" name="name with space" value="some_value">
Such names are invalid:
| ID and NAME tokens must begin with a letter ([A-Za-z]) and may be | followed by any number of letters, digits ([0-9]), hyphens ("-"), | underscores ("_"), colons (":"), and periods (".").
No, the value of the name attribute of the form element is declared as CDATA, not as a NAME token, so pretty much anything goes, including spaces.
Indeed, had forgotten that. Thanks for the correction.
I would still avoid them.
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Cal Lidderdale |
last post by:
I've built a OutOfOffice calendar in PHP. Each month is a standalone table,
the first column being the person's name. Then N cells, one for each...
|
by: Angie |
last post by:
Hello everybody,
I have an osCommerce shopping cart on my site, which is an open-source
product that uses php. I'm very new to php. I also have...
|
by: vishal |
last post by:
hi
vishal here.
could anyone tell me what is difference between get-post and head-put
method of passing data between diffrent different web...
|
by: Paul M |
last post by:
Hi
Sorry if this is posted in the wrong group but I'm brand new to this
area. Basically I've got to post some XML documents to an external
server...
|
by: Ron Peleg, Creo |
last post by:
Hi,
I know you can call the WS methods using HTTP GET/POST, simply by
providing the method name in the URL and appending the parameters as
the...
|
by: David T. Ashley |
last post by:
Are GET and POST parameters required to have values, i.e. are either of
these legal?
http://www.mydomain.com/index.php?this&that
...
|
by: ziana |
last post by:
Hi all,
What is the disadvantages of using GET/POST/COOKIES in php?
What's the different when i use global below included in each files?, i can...
|
by: rup |
last post by:
Hello,
This is my first application on socket programming in vc++. I am facing
problem that how to make connection to server, & make GET/POST...
|
by: rup |
last post by:
Hello,
This is my first application on socket programming in vc++. I am facing
problem that how to make connection to server, & make GET/POST...
|
by: jake |
last post by:
I think I may why this is happening but I am a little fuzzy as to what
the solution should be as I am somewhat new to all of this.
My simplified...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
| | |