LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-20-2017, 03:27 AM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Question [PHP] Input name containing a period is converted to an underscore?


Hey LQ

I know this isn't the best place to post this kind of thing but I can't seem to login to sitepoint at the moment.

Anyhow, this is my issue.
I have a script with a form.

Code:
<form action="submit.php" method="POST">
  <input name="title.title" value="a title" />
  <input type="submit" value="Test" />
</form>
You can see quite clearly, the name of the input field is "title.title".

On the receiving (submit.php) side we have

Code:
<? print_r($_POST); exit(); ?>
And output for that is

Code:
Array
(
    [title_title] =&gt; a title
)
Can anyone explain to me why it's converting the period to an underscore, is this a PHP thing? Is it related to my browser? (latest Firefox)

I've never come across this issue in 10+ years of writing PHP.
 
Old 05-20-2017, 05:30 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
A PHP thing. If what is posted in the link is true then the changed happened in version 5.3.0.

http://php.net/manual/en/language.va...s.external.php

Last edited by michaelk; 05-20-2017 at 03:17 PM.
 
1 members found this post helpful.
Old 05-20-2017, 02:51 PM   #3
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by michaelk View Post
A PHP thing. If what is posted in the link is true then the changed happened in version 5.4.0.

http://php.net/manual/en/language.va...s.external.php
That explains it. All to keep compatibility with some deprecated feature. SMH.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "Catchable fatal error: Object of class input could not be converted to string" - php Skyer Programming 2 03-12-2012 11:04 PM
How to incorporate Contention free period and contention period together in 802.11e? stud17 Linux - Newbie 0 01-20-2012 05:27 PM
PHP "Object of class mysqli could not be converted to string " Randall Slack Programming 1 12-02-2011 10:02 AM
PHP: No Input File Specified rickymaloy Fedora 6 02-05-2008 08:28 PM
coding problem on php auto send mail after a period akamaru607 Programming 12 09-01-2005 07:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration