Jump to content
php.lv forumi

html form action


rebuilder

Recommended Posts

Laba diena,

 

šodien saskāros ar tādu dīvainu un neierastu lietu.

Ir html forma un pie action norādīts

<?php echo $PHP_SELF;?>

. Visa lapa tiek includota caur index failu, respektīvi, ja parādās $_GET['pamparam'] tiek includoti attiecīgās sadaļas faili.

Uz nano.lv servera vis darbojās lieliski, form action nostrādā, bet uz viena cita, pat nezinu, privāta vai nē, servera ar

<?php echo $PHP_SELF;?>

pie form action, apskatot source parādās action="index.php"...

 

Mēģināju arī šo variantu

<?php echo $_SERVER['PHP_SELF']; ?>

bet parādās tas pats action="index.php" un no formas nekas nenonāk datubāzē, varbūt kāds apgaismos, kur vaina?

 

Vienīgā ideja, kas man ir, likt pie form action tiešo lapas adresi, respektīvi apmēram kaut kā šādi:

 

"http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

 

bet nu nezinu cik tas ir racionāli vai nē.

Edited by rebuilder
Link to comment
Share on other sites

iz php manuāļa komentāriem.

Note the manual entry for PHP_SELF states the following:

 

"The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar."

 

However I did some vigorous testing on three different machines and this note is not always true. The results are given below:

 

Given a URL of http://www.example.com/Info.php/Page/Home

 

Apache 2.2.4/Win32/PHP 5.2.2/Apache 2.0 Handler

----> PHP_SELF = Info.php/Page/Home

 

Apache 1.3.37/Unix/PHP 5.2.2/CGI

----> PHP_SELF = Info.php

 

Apache 1.3.33/Unix/5.1.4/FastCGI

----> PHP_SELF = Info.php

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...