Posted by Hilarion on 11/29/05 13:40
> [snip]
>>> <form action="" method="post">
>>
>> Give some value to the "action" attribute. Using empty "action"
>> works differently in different browser. Your browser probably
>> does not send the data in this case.
>>
>
> action="" posts the data to the file\page that is loaded.
In some browsers - yes. Read HTML specification. Value of
"action" attribute in "form" tag is REQUIRED.
Look here:
http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.3
quote:
"This attribute specifies a form processing agent. User agent
behavior for a value other than an HTTP URI is undefined."
Empty value is not a HTTP URI.
> As you will also see from the OP, the data *is* being sent
As I wrote - some browsers may behave like this. Yours apparently
does behave like this (which means that the wrong value of
"action" attribute is not the cause of the problem). This does NOT
mean that all browser will, so if you want your form to be
submitable in some other browsers too, then you should specify
valid value.
> [snip]
>> <form action="<?php echo htmlspecialchars( $_SERVER['PHP_SELF'] ); ?>"
>> method="post">
> [snip]
>
> There is some problem with your above action as it sends the post to
>
> http://home/public_html/test.php
> not
> http://home/test.php
>
> the absolute path to the script is C:/XITAMI-25/APP/public_html/test.php
> where C:/XITAMI-25/APP/public_html/ is analogous to my server's http://home
Which means that your server configuration is somehow screwed.
$_SERVER['PHP_SELF'] should point to the URL of the script which
was originally called. Maybe some value in your php.ini suggests that
"http://home/public_html/" is your DOCUMENT_ROOT (or something like
that, I'm not sure).
Hilarion
[Back to original message]
|