Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

$PHP_SELF

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

$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.
misterjingo
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Nov 23, 2002 6:10 pm

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
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

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 ?
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

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?
misterjingo
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Nov 23, 2002 6:10 pm

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
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

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
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron