$PHP_SELF

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

misterjingo
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Nov 23, 2002 6:10 pm

$PHP_SELF

Postby misterjingo » Sat Nov 23, 2002 6:16 pm

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.

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

Re: $PHP_SELF

Postby 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">

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

Re: $PHP_SELF

Postby 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 ?

misterjingo
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Nov 23, 2002 6:10 pm

Postby misterjingo » Sun Nov 24, 2002 4:19 am

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?

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

Postby 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

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

Postby 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


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron