$PHP_SELF

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

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

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">
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

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

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: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

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
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

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

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