473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Where is form handler code?

Hello all,

I'm working on an open source PHP project.

Can anyone give me a pointer what PHP does when there is no 'action='
specified in the form tag?

An example being: <form name='EditEntity' method='POST'>

I've seached all the code for 'EditEntity' and '$_POST' but no sign of
either.

Thanks in advance, mike

Feb 1 '06 #1
7 1377
mw****@yahoo.co.uk wrote:
Hello all,

I'm working on an open source PHP project.

Can anyone give me a pointer what PHP does when there is no 'action='
specified in the form tag?

An example being: <form name='EditEntity' method='POST'>

I've seached all the code for 'EditEntity' and '$_POST' but no sign of
either.

Thanks in advance, mike


I believe it depends on the UA being used, but IME, it posts back to the
same uri (the page that has the form)

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Feb 1 '06 #2
mw****@yahoo.co.uk wrote:
Hello all,

I'm working on an open source PHP project.

Can anyone give me a pointer what PHP does when there is no 'action='
specified in the form tag?

An example being: <form name='EditEntity' method='POST'>

I've seached all the code for 'EditEntity' and '$_POST' but no sign of
either.

Thanks in advance, mike


Hi Mike,

It will post to the same URL where the form originated from, so in most
circumstances, it will post to itself.

I am unsure if it is correct to leave the action out.
Why not fix it and put the right action-value in?

Good luck,
Erwin Moller
Feb 1 '06 #3

Erwin Moller:
I am unsure if it is correct to leave the action out.
Why not fix it and put the right action-value in?


The action is a required attribute, according to the W3C HTML 4.01
specification. User-agents use the current page as the action, so
setting action to $_SERVER['PHP_SELF'] would make it work and
standards-compliant.

Feb 1 '06 #4
You could simply leave the action attribute empty, this also posts back
to itself.

Feb 1 '06 #5
Yeah, you could but then as Sjoerd said, you wouldn't be W3C standard
compliant.

http://www.w3schools.com/tags/tag_form.asp

Feb 2 '06 #6
Sjoerd wrote:
Erwin Moller:
I am unsure if it is correct to leave the action out.
Why not fix it and put the right action-value in?

The action is a required attribute, according to the W3C HTML 4.01
specification. User-agents use the current page as the action, so
setting action to $_SERVER['PHP_SELF'] would make it work and
standards-compliant.


To elaborate a bit (or add to the confusion). Above should, not so
obviously, be read as two separate statements, with a not so
straightforward relation.
PHP_SELF only contains the absolute path, not a full URI as specified
in the mentioned W3C document, which further says "This attribute
specifies a form processing agent. User agent behavior for a value
other than an HTTP URI is undefined.".
But as it is only a specification of a recommendation, the actual
implementation in user-agents is chosen in the finest tradition of
anarchism, leading to more or less convenient/sensible/ingenious
solutions, which in a competing market(governed by greed), tends to,
but certainly not always, conform with any common practice among the
general public (aka end-users), which in turn may or may not be
compliant to any would-like-to-be-normative specifications.

Consequently, ergo and vis-a-vis dubious intentions and demands, much
can be written in the action attribute, with the disappointing result:
"it works".
/Bent
Feb 3 '06 #7
Bent Stigsen wrote:
Sjoerd wrote:
Erwin Moller:
I am unsure if it is correct to leave the action out.
Why not fix it and put the right action-value in?

The action is a required attribute, according to the W3C HTML 4.01
specification. User-agents use the current page as the action, so
setting action to $_SERVER['PHP_SELF'] would make it work and
standards-compliant.


To elaborate a bit (or add to the confusion). Above should, not so
obviously, be read as two separate statements, with a not so
straightforward relation.
PHP_SELF only contains the absolute path, not a full URI as specified
in the mentioned W3C document, which further says "This attribute
specifies a form processing agent. User agent behavior for a value
other than an HTTP URI is undefined.".
But as it is only a specification of a recommendation, the actual
implementation in user-agents is chosen in the finest tradition of
anarchism, leading to more or less convenient/sensible/ingenious
solutions, which in a competing market(governed by greed), tends to,
but certainly not always, conform with any common practice among the
general public (aka end-users), which in turn may or may not be
compliant to any would-like-to-be-normative specifications.

Consequently, ergo and vis-a-vis dubious intentions and demands, much
can be written in the action attribute, with the disappointing result:
"it works".
/Bent


LMAO!

Bent, I nominate your contribution for 'Weirdest post of the month', a not
so wellknown, but nevertheless considered important by me, trophy.

And since I am the jury too: Here you go! The trophy!

Thanks for good laugh. :P

Regards,
Erwin Moller
Feb 3 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Peter Adolphs | last post by:
Hi newsgroup! The W3C HTML 4.01 recommendation states that "The onreset event occurs when a form is reset." Using Mozilla 1.4.1, how come that if I set onreset="return false;", the form is not...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
5
by: Dave | last post by:
How do I check in a Windows Forms app if any controls have changed? I have a form that collects data, and I want to prompt the user if they try to exit the app, or load a new file, without saving...
10
by: Chad Miller | last post by:
I currently have a base form that I inherit. The base for has a custom event. The event will not raise threw the inherited form. I was wondering if events work threw inheritance or should I use...
13
by: Lorne Smith | last post by:
Hi, First, sorry for the crosspost, but it seemed appropriate... :) I've come accross what I consider to be a bug, but I don't know if it's already known or not. (VS .Net 2003 Pro - VB.Net) ...
3
by: jimcolli | last post by:
I have a parent form with a menu button that has a handler. I want to call this same handler when a button on a child form is clicked. I have this simplified code in the main form's Load...
4
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on...
4
by: sameergn | last post by:
Hi, I have an image in my HTML form which has onclick() handler. There is also a submit button and a text box. Whenever text box has focus and user presses enter, the onclick() event of...
6
by: tony | last post by:
Hello! When exactly is it important or advisable to use this form load event handler compare to using the C-tor. For example here I create an event handler called dataBoundGridForm that is...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.