$PHP_SELF

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
WiZARD
Moderator
Moderator
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: $PHP_SELF

Post by WiZARD » Sun Nov 24, 2002 1:31 am

misterjingo wrote:Hi all, im having trouble with PHP_SELF. My problem is global vars are off, so to combat this I use:
<form action="<?php print $_SERVER['PHP_SELF'] ?>" method="post">
in the form method. Yet the variables are still not passed until I use
$var = $_POST['var'] name
But doing this displays a warning of an unindexed var durings the pages first display, after the values have been submitted the errors go because the vars now contain data.
Am I going about this all the wrong way? Any help will be greatly appreciated.


Hi!
Try this:

Code: Select all

<form action="<?php echo $PHP_SELF; ?>" method="post">

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Re: $PHP_SELF

Post by Oleg Butuzov » Sun Nov 24, 2002 3:43 am

misterjingo wrote:Hi all, im having trouble with PHP_SELF. My problem is global vars are off, so to combat this I use:
<form action="<?php print $_SERVER['PHP_SELF'] ?>" method="post">
in the form method. Yet the variables are still not passed until I use
$var = $_POST['var'] name
But doing this displays a warning of an unindexed var durings the pages first display, after the values have been submitted the errors go because the vars now contain data.
Am I going about this all the wrong way? Any help will be greatly appreciated.


Are you use Windows ?

User avatar
WiZARD
Moderator
Moderator
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Post by WiZARD » Sun Nov 24, 2002 5:04 am

misterjingo wrote:I'm running the php scripts on localhost (apache 2.0.42) under winxp to test them. Is this perhaps something to do with the notice?

Change you PHP on 4.2.3

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Post by Oleg Butuzov » Mon Nov 25, 2002 2:30 am

Code: Select all

ereg("/__php_dir__/php\\.exe(.*)",$PHP_SELF,$regs);
$GLOBALS["PHP_SELF"]=$regs[1];


try this

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 3 guests