Re: [PHP] $PHP_SELF or echo $PHP_SELF

2005-07-14 Thread Matthew Weier O'Phinney
* Richard Davey <[EMAIL PROTECTED]>:
> Hello Ross,
>
> Thursday, July 14, 2005, 11:11:25 AM, you wrote:
>
> R> Just a quick thing that is bugging me. In some of my older
> R> textbooks a form is returned to the same page by using
>
> R> echo $PHP_SELF no just $PHP_SELF
>
> R> is this just used in older versions of php?? Does the it make a
> R> difference what one is used?
>
> PHP_SELF is part of the $_SERVER super global, you should really
> access it like this:
>
> $_SERVER['PHP_SELF']
>
> To answer your question though, it's just a variable - if you want to
> output it into your form action then you can do either:
>
>  or 
>
> Either would work.

Actually, to be truly portable, it should be:



Not all hosts have short tags enabled in their PHP installations.

Additionally, you have to be careful with PHP_SELF. On web servers that
allow PATH_INFO -- i.e., arguments to the script in the form of path
information, like '/path/to/script.php/more/path/info -- PHP_SELF will
contain the path to the script PLUS the contents of
$_SERVER['PATH_INFO'] -- which leaves PHP_SELF vulnerable to cross-site
scripting attacks. For some discussion on this, see:

http://blog.phpdoc.info/archives/13-XSS-Woes.html

If you're using Apache, the safer bet is to use $_SERVER['SCRIPT_NAME'];
otherwise, use PHP_SELF, but filter it to exclude the path information.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF or echo $PHP_SELF

2005-07-14 Thread Richard Davey
Hello Ross,

Thursday, July 14, 2005, 11:11:25 AM, you wrote:

R> Just a quick thing that is bugging me. In some of my older
R> textbooks a form is returned to the same page by using

R> echo $PHP_SELF no just $PHP_SELF

R> is this just used in older versions of php?? Does the it make a
R> difference what one is used?

PHP_SELF is part of the $_SERVER super global, you should really
access it like this:

$_SERVER['PHP_SELF']

To answer your question though, it's just a variable - if you want to
output it into your form action then you can do either:

 or 

Either would work.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF & SCRIPT_NAME differences

2004-10-12 Thread Curt Zirzow
* Thus wrote John Holmes:
> Jordi Canals wrote:
> >I'd like to know the difference by using the $_SERVER['PHP_SELF'] and
> >$_SERVER['SCRIPT_NAME'] variables. After I read the manual, I have not
> >found the difference betwen the two when used in a Web Script. Also,
> >in all tests I've done, I get the same result in both variables.
> 
> PHP_SELF seems to be more reliable as SCRIPT_NAME isn't populated on 
> some OS, in my experiences. But if both are present, they'll have the 
> same value.

SCRIPT_NAME comes from CGI 1.1 and is required according to the
specifications, iirc, it depends on how well the paticular
webserver impelments the CGI spec when running php as a module.

PHP_SELF will almost always be filled out, it is defined within PHP
itself.

Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF & SCRIPT_NAME differences

2004-10-12 Thread John Holmes
Jordi Canals wrote:
I'd like to know the difference by using the $_SERVER['PHP_SELF'] and
$_SERVER['SCRIPT_NAME'] variables. After I read the manual, I have not
found the difference betwen the two when used in a Web Script. Also,
in all tests I've done, I get the same result in both variables.
PHP_SELF seems to be more reliable as SCRIPT_NAME isn't populated on 
some OS, in my experiences. But if both are present, they'll have the 
same value.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] $PHP_SELF AND INFORMATION.

2004-02-04 Thread John Nichel
Philip J. Newman wrote:

$_SERVER["PHP_SELF"]; returns /c/hosting/newman/hello.php

is there an easy way to get get hello.php?
Didn't we just have this question today?

http://www.php.net/manual/en/function.basename.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] $PHP_SELF AND INFORMATION.

2004-02-04 Thread Martin Towell
http://au2.php.net/manual/en/function.basename.php

Martin

> -Original Message-
> From: Philip J. Newman [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 5 February 2004 11:57 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] $PHP_SELF AND INFORMATION.
> 
> 
> $_SERVER["PHP_SELF"]; returns /c/hosting/newman/hello.php
> 
> is there an easy way to get get hello.php?
> 
> ---
> Philip J. Newman
> Master Developer
> PhilipNZ.com [NZ] Ltd.
> [EMAIL PROTECTED]
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> __ Information from NOD32 1.614 (20040129) __
> 
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
> 
> 
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF

2003-10-20 Thread Nathan Taylor
$PHP_SELF is a variable that is a variable that has limited scope and as a rule of 
thumb should never be used. It is a very sloppy way to code.  I advise you stick to 
$_SERVER['PHP_SELF'].
  - Original Message - 
  From: Boris Sagadin 
  To: [EMAIL PROTECTED] 
  Sent: Monday, October 20, 2003 7:23 AM
  Subject: [PHP] $PHP_SELF



  I'm having problems with $PHP_SELF variable. Mostly it works, other
  times (about 10% of tries) it's just empty. Is this a known issue with Apache
  2? If I use $_SERVER['PHP_SELF'], it always works fine, but still I'd
  like to know if this is a common bug or there's something wrong with
  my configuration.

  I'm using PHP 4.3.3 with Apache 2.0.43, Linux 2.4.21-grsec, register_globals is on

  Thanks,
  Boris

  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF

2003-10-20 Thread Eugene Lee
On Mon, Oct 20, 2003 at 01:23:29PM +0200, Boris Sagadin wrote:
: 
: I'm having problems with $PHP_SELF variable. Mostly it works, other
: times (about 10% of tries) it's just empty. Is this a known issue with
: Apache 2? If I use $_SERVER['PHP_SELF'], it always works fine, but
: still I'd like to know if this is a common bug or there's something
: wrong with my configuration.
: 
: I'm using PHP 4.3.3 with Apache 2.0.43, Linux 2.4.21-grsec,
: register_globals is on

It is a common bug with your configuration.  Turn off register_globals,
and always use the superglobals ($_SERVER, $_POST, $_GET, etc.).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF and include all variables?

2003-10-19 Thread Justin French
On Wednesday, October 15, 2003, at 01:12  AM, 
[EMAIL PROTECTED] wrote:

I'm using $PHP_SELF, but need to automatically record what variables 
are
in the URL at that time...
is that possible?
try to get in the habbit of using $_SERVER['PHP_SELF'] on PHP >= 4.1, 
because $PHP_SELF is deprecated.

anyway, to answer your question, try $_SERVER['QUERY_STRING'] or 
$QUERY_STRING (deprecated).

Justin French

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [otro] Re: [PHP] $PHP_SELF

2003-06-06 Thread j0rd1 adame
you should also try with dirname(__FILE__) for getting the real path

j0rd1
On Thursday 05 June 2003 16:51, Stephen wrote:
> Try $HTTP_SERVER_VARS['PHP_SELF']
>
> I'm not yours, so why should I be sincere about it,
> Stephen Craton
> Senior Executive Web Developer
> Mophus.com, Inc.
>
>
> - Original Message -
> From: "Johnny Martinez" <[EMAIL PROTECTED]>
> To: "php list" <[EMAIL PROTECTED]>
> Sent: Thursday, June 05, 2003 4:36 PM
> Subject: [PHP] $PHP_SELF
>
>
> Hi all,
> I'm trying to get the path and filename of the script I am running.
> $PHP_SELF doesn't seem to work. I'm running PHP4 on a Windows 2000 system.
> Thanks in advance.
>
> Johnny
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF

2003-06-06 Thread Stephen
Try $HTTP_SERVER_VARS['PHP_SELF']

I'm not yours, so why should I be sincere about it,
Stephen Craton
Senior Executive Web Developer
Mophus.com, Inc.


- Original Message - 
From: "Johnny Martinez" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 4:36 PM
Subject: [PHP] $PHP_SELF


Hi all,
I'm trying to get the path and filename of the script I am running.
$PHP_SELF doesn't seem to work. I'm running PHP4 on a Windows 2000 system.
Thanks in advance.

Johnny

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF with redirected domain

2003-03-03 Thread bill
Thanks Chris for your thoughts, but no success yet.

Details interspersed below

Chris Hayes wrote:

> ...and the problem that the form immediately goes to the real url is that
> people see the real url?

No, the problem is that the URLs don't match.  The browser does accurately find
the page, etc., but the url is "wrong."  It makes it hard to evaluate site
statistics, etc.

> What about one of the following:
>
>   - chop off the subdir again by only putting the last part of $PHP_SELF as
> form action (f.i. with a combination of substr($PHP_SELF,...,...) and
> strpos('/') )

It would be easier to hard code the name of the page in the POST.  With this
suggestion, what if I move the page to a deeper subdir?  I want PHP_SELF to be
the same url as the page.

> or
>   -  when i do a full path in the redirect in .htaccess:
>  ErrorDocument 404 http://www.domain.org/redirect/redirect.php
>  it is treated as a fresh page and all form results are lost
>
>  but when i do
>  ErrorDocument 404 /redirect/redirect.php
>  in .htaccess,  the original post and get vars stay, and i suppose
> also the  original $PHP_SELF
>
> Maybe the same happens with your thing, i happen not to know what %1/$1
> does. If %1 is the domain, try to do it without that (but with the slash,
> so /$1 ). Worth a try innit?

Tried that and redirecting failed.

> or
> - simply make a new page that receives the file, or not using $PHP_SELF but
> the actual filename.

Can't do that, the page is repeatedly and indefinitely called.

Others have asked me to tell them if we find a solution.  Which we're still
looking for, I guess.  I'm still open to suggestions.

kind regards,

bill

> At 18:42 26-2-03, you wrote:
> >If I use $PHP_SELF as the action in a form where the domain name is
> >redirected,
> >I get the extra directory.
> >
> >Is there a way around that?
> >
> >Details:
> >
> >The domain name is redirected in .htaccess like this:
> >
> >RewriteCond   %{REQUEST_URI}  !domain2
> >RewriteRule   ^(.*)   %1/$1 [L]
> >
> >So, domain2 is really a directory on domain1, but http://domain2.com will be
> >taken to that directory on domain 1 as if it was the http root
> >
> >But, when using $PHP_SELF, I get the extra directory, so the form may start
> >here:
> >
> >http://domain2.com/myform.php
> >
> >But the $PHP_SELF forces the next POST page to be
> >
> >http://domain2.com/domain2/myform.php
> >
> >Ideas?
> >
> >kind regards,
> >
> >bill hollett
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $PHP_SELF with redirected domain

2003-02-26 Thread Chris Hayes
...and the problem that the form immediately goes to the real url is that 
people see the real url?

What about one of the following:

 - chop off the subdir again by only putting the last part of $PHP_SELF as 
form action (f.i. with a combination of substr($PHP_SELF,...,...) and 
strpos('/') )

or
 -  when i do a full path in the redirect in .htaccess:
ErrorDocument 404 http://www.domain.org/redirect/redirect.php
it is treated as a fresh page and all form results are lost
but when i do
ErrorDocument 404 /redirect/redirect.php
in .htaccess,  the original post and get vars stay, and i suppose 
also the  original $PHP_SELF

Maybe the same happens with your thing, i happen not to know what %1/$1 
does. If %1 is the domain, try to do it without that (but with the slash, 
so /$1 ). Worth a try innit?

or
- simply make a new page that receives the file, or not using $PHP_SELF but 
the actual filename.

At 18:42 26-2-03, you wrote:
If I use $PHP_SELF as the action in a form where the domain name is 
redirected,
I get the extra directory.

Is there a way around that?

Details:

The domain name is redirected in .htaccess like this:

RewriteCond   %{REQUEST_URI}  !domain2
RewriteRule   ^(.*)   %1/$1 [L]
So, domain2 is really a directory on domain1, but http://domain2.com will be
taken to that directory on domain 1 as if it was the http root
But, when using $PHP_SELF, I get the extra directory, so the form may start
here:
http://domain2.com/myform.php

But the $PHP_SELF forces the next POST page to be

http://domain2.com/domain2/myform.php

Ideas?

kind regards,

bill hollett

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP_SELF syntax

2003-02-24 Thread Justin French
on 24/02/03 11:42 AM, Jason Lange ([EMAIL PROTECTED]) wrote:

> What you might try is removing the single-quotes from around PHP_SELF.
> 
> Before: $_SERVER['PHP_SELF']
> After:  $_SERVER[PHP_SELF]
> 
> Another note: as far as I can tell you do not need the braces ({}) to
> enclose a variable within a double-quoted string. I may be wrong, but
> nothing I've read advocates doing this, and I've never had a problem
> with my code when I've written it this way.

Wrapping vars in braces helps clarify the code, and can avoid problems like:



I've also found it helps with things like:

click";
?>

... where normally the single quotes would cause confusion, or require the
href to be wrapped in escaped double quotes.

In otherwords, wrapping $vars in {braces} provides clarity to both the PHP
parser, and to the writer, IMHO.


Justin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF syntax

2003-02-24 Thread Ernest E Vogelsinger
At 01:42 24.02.2003, Jason Lange spoke out and said:
[snip]
>What you might try is removing the single-quotes from around PHP_SELF.
>
>Before: $_SERVER['PHP_SELF']
>After:  $_SERVER[PHP_SELF]

This is only valid if the array is contained within a double quoted string
- it will generate a parser warning outside a string (undefind constant
PHP_SELF).

>Another note: as far as I can tell you do not need the braces ({}) to 
>enclose a variable within a double-quoted string. I may be wrong, but 
>nothing I've read advocates doing this, and I've never had a problem 
>with my code when I've written it this way.

The docs on strings
(http://www.php.net/manual/en/language.types.string.php) clearly states this:

"If a dollar sign ($) is encountered, the parser will greedily take as much
tokens as possible to form a valid variable name. Enclose the variable name
in curly braces if you want to explicitly specify the end of the name."

$fruits = array('strawberry' => 'red', 'banana' => 'yellow');
// Works but note that this works differently outside string-quotes
echo "A banana is $fruits[banana].";
// Works
echo "A banana is {$fruits['banana']}.";
// Works but PHP looks for a constant named banana first
// as described below.
echo "A banana is {$fruits[banana]}.";
// Won't work, use braces.  This results in a parse error.
echo "A banana is $fruits['banana'].";
// Works
echo "A banana is " . $fruits['banana'] . ".";


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF syntax

2003-02-24 Thread 1LT John W. Holmes
> What you might try is removing the single-quotes from around PHP_SELF.
>
> Before: $_SERVER['PHP_SELF']
> After:  $_SERVER[PHP_SELF]
>
> Another note: as far as I can tell you do not need the braces ({}) to
> enclose a variable within a double-quoted string. I may be wrong, but
> nothing I've read advocates doing this, and I've never had a problem
> with my code when I've written it this way.

Just so there's no confusion, with double quoted strings, you can do it one
of two ways.

echo "The value is {$_SERVER['PHP_SELF']}";
or
echo "The value is $_SERVER[PHP_SELF]";

Neither is any more right than the other. You can always end the string and
concatinate the variable, too...

echo "The value is " . $_SERVER['PHP_SELF'];

In that case, you should always use quotes around the key, single or double,
doesn't matter much.

---John Holmes...

> > [snip]
> >
> >>Could someone tell me why this code prompts a parse error. I have tried
it
> >>several different way. The statement is called from within a function:
> >>
> >>print " >>action=\"$_SERVER['PHP_SELF']\">\n";
> >
> > [snip]
> >
> > When using array elements within a string you must enclose it in curly
> > brackets, like this:
> >
> > print " > action=\"{$_SERVER['PHP_SELF']}\">\n";
> >
> > HTH,
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF syntax

2003-02-24 Thread Jason Lange
What you might try is removing the single-quotes from around PHP_SELF.

Before: $_SERVER['PHP_SELF']
After:  $_SERVER[PHP_SELF]
Another note: as far as I can tell you do not need the braces ({}) to 
enclose a variable within a double-quoted string. I may be wrong, but 
nothing I've read advocates doing this, and I've never had a problem 
with my code when I've written it this way.

Jason

Ernest E Vogelsinger wrote:
At 00:55 24.02.2003, Peter Gumbrell said:
[snip]
Could someone tell me why this code prompts a parse error. I have tried it
several different way. The statement is called from within a function:
print "\n";
[snip] 

When using array elements within a string you must enclose it in curly
brackets, like this:
print "\n";
HTH,



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP_SELF syntax

2003-02-23 Thread David Otton
On Sun, 23 Feb 2003 18:55:06 -0500, you wrote:

>Could someone tell me why this code prompts a parse error. I have tried it
>several different way. The statement is called from within a function:
>
>print "action=\"$_SERVER['PHP_SELF']\">\n";

echo ('' . "\n");

works for me (moved the variable outside the string). I first thought it
might be a scope problem, but $_SERVER is apparently a superglobal so
that's not it.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF syntax

2003-02-23 Thread Ernest E Vogelsinger
At 00:55 24.02.2003, Peter Gumbrell said:
[snip]
>Could someone tell me why this code prompts a parse error. I have tried it
>several different way. The statement is called from within a function:
>
>print "action=\"$_SERVER['PHP_SELF']\">\n";
[snip] 

When using array elements within a string you must enclose it in curly
brackets, like this:

print "\n";

HTH,

-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP_SELF Variable

2002-12-10 Thread info
Hello Leif, hello all,

register_globals is on

How can I use the superglobal array?

And here is how my php behave:
when I run the following script: info70.php

1) from commandline
then  [SCRIPT_NAME] => info70.php
is set correctly

2) direkt via http request from browser
then PHP_SELF = htdocs3/bildvote/admin/info70.php

zend and php-logo isn´t depicted.

3) via http script is in the htdocs (/usr/local/apache/htdocs) directory
  PHP_SELF = 

  What can I do?

  Oliver Etzel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Variable

2002-12-10 Thread Leif K-Brooks
It's because register_globals is off by default in your 4.3 
installation.  Change it in php.ini, or use the superglobal array instead.

[EMAIL PROTECTED] wrote:

Hi Leif, hi all,

when I run the following script from commandline (RedHat7.3)
PHP_SELF has a value and I will get the following result:

--- snip
   [_] => /usr/local/bin/php
   [OLDPWD] => /home/fritz/htdocs3/bildvote/admin
   [PHP_SELF] => info70.php
   [SCRIPT_NAME] => info70.php
   [SCRIPT_FILENAME] => info70.php
   [PATH_TRANSLATED] => info70.php
   [DOCUMENT_ROOT] => 
   [argv] => Array

--- snip

How can I get this value when I run it as a CGI?

Oliver Etzel
 - Original Message - 
 From: Leif K-Brooks 
 To: [EMAIL PROTECTED] 
 Cc: [EMAIL PROTECTED] 
 Sent: Tuesday, December 10, 2002 1:03 PM
 Subject: Re: [PHP] PHP_SELF Variable


 Odd.  Mind doing: print_r($GLOBALS); and tsending the results?

 [EMAIL PROTECTED] wrote:

 >Hello Johannes, hello all,
 >
 >I compiled it as CGI-php
 >and the variable $_SERVER['PHP_SELF']  has no value either.
 >
 >What can I do on order to give PHP_SELF the right value?
 >
 >Oliver Etzel 
 >  On Tuesday 10 December 2002 12:36, info AT t-host.com wrote:
 >  > after successfully compiling and installing php.4.3-dev from tarball
 >  > ...
 >  > PHP_SELF has no value. How can I set this?
 >
 >  Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look 
 >  for "register_globals"
 >
 >  johannes
 >
 >  -- 
 >  PHP General Mailing List (http://www.php.net/)
 >  To unsubscribe, visit: http://www.php.net/unsub.php
 >
 >
 >  
 >

 -- 
 The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Variable

2002-12-10 Thread info
Hi Leif, hi all,

when I run the following script from commandline (RedHat7.3)
PHP_SELF has a value and I will get the following result:

--- snip
[_] => /usr/local/bin/php
[OLDPWD] => /home/fritz/htdocs3/bildvote/admin
[PHP_SELF] => info70.php
[SCRIPT_NAME] => info70.php
[SCRIPT_FILENAME] => info70.php
[PATH_TRANSLATED] => info70.php
[DOCUMENT_ROOT] => 
[argv] => Array

--- snip

How can I get this value when I run it as a CGI?

Oliver Etzel
  - Original Message - 
  From: Leif K-Brooks 
  To: [EMAIL PROTECTED] 
  Cc: [EMAIL PROTECTED] 
  Sent: Tuesday, December 10, 2002 1:03 PM
  Subject: Re: [PHP] PHP_SELF Variable


  Odd.  Mind doing: print_r($GLOBALS); and tsending the results?

  [EMAIL PROTECTED] wrote:

  >Hello Johannes, hello all,
  >
  >I compiled it as CGI-php
  >and the variable $_SERVER['PHP_SELF']  has no value either.
  >
  >What can I do on order to give PHP_SELF the right value?
  >
  >Oliver Etzel 
  >  On Tuesday 10 December 2002 12:36, info AT t-host.com wrote:
  >  > after successfully compiling and installing php.4.3-dev from tarball
  >  > ...
  >  > PHP_SELF has no value. How can I set this?
  >
  >  Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look 
  >  for "register_globals"
  >
  >  johannes
  >
  >  -- 
  >  PHP General Mailing List (http://www.php.net/)
  >  To unsubscribe, visit: http://www.php.net/unsub.php
  >
  >
  >  
  >

  -- 
  The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.




  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Variable

2002-12-10 Thread Leif K-Brooks
Odd.  Mind doing: print_r($GLOBALS); and tsending the results?

[EMAIL PROTECTED] wrote:


Hello Johannes, hello all,

I compiled it as CGI-php
and the variable $_SERVER['PHP_SELF']  has no value either.

What can I do on order to give PHP_SELF the right value?

Oliver Etzel 
 On Tuesday 10 December 2002 12:36, info AT t-host.com wrote:
 > after successfully compiling and installing php.4.3-dev from tarball
 > ...
 > PHP_SELF has no value. How can I set this?

 Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look 
 for "register_globals"

 johannes

 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Variable

2002-12-10 Thread info
Hello Johannes, hello all,

I compiled it as CGI-php
and the variable $_SERVER['PHP_SELF']  has no value either.

What can I do on order to give PHP_SELF the right value?

Oliver Etzel 
  On Tuesday 10 December 2002 12:36, info AT t-host.com wrote:
  > after successfully compiling and installing php.4.3-dev from tarball
  > ...
  > PHP_SELF has no value. How can I set this?

  Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look 
  for "register_globals"

  johannes

  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Variable

2002-12-10 Thread Johannes Schlueter
On Tuesday 10 December 2002 12:36, info AT t-host.com wrote:
> after successfully compiling and installing php.4.3-dev from tarball
> ...
> PHP_SELF has no value. How can I set this?

Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look 
for "register_globals"

johannes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Variable

2002-12-10 Thread info
Hello Leif, hello all,

after successfully compiling and installing php.4.3-dev from tarball
there in my info.php the variable  
  Variable Value 
  PHP_SELF    


PHP_SELF has no value. How can I set this?

Oliver Etzel


Re: [PHP] PHP_SELF Variable

2002-12-10 Thread Leif K-Brooks
Not quite sure what you mean, but I'm guessing you're trying to use 
$PHP_SELF and it's not set.  If that's the case, use 
$_SERVER['PHP_SELF'] instead.  Register_globals defaults to disabled now.

[EMAIL PROTECTED] wrote:

Hello List,

anybody knows how to set the PHP_SELF variable?

Short answers are welcome...
Oliver Etzel
 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF empty when using Xitami Web Server

2002-04-20 Thread Jason Wong

On Sunday 21 April 2002 00:51, Ben Edwards wrote:
> The variable $PHP_SELF seems to be blank, I am using PHP 4.1.2 and Xitami
> 2.4d9 which are both the latest version.  Has anyone else had this problem
> and do they know how to fix it?

use:

 print_r($GLOBALS) 

to verify.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"The pathology is to want control, not that you ever get it, because of
course you never do."
-- Gregory Bateson
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF question

2002-04-19 Thread Justin French

Spend a bit of time reading up on predefined variables (like $PHP_SELF) in
the manual:

http://www.php.net/manual/fi/reserved.variables.php

I believe you're after SCRIPT_NAME, but it's worth familiarising yourself
with them all for future reference.


Justin French

Creative Director
http://Indent.com.au





on 18/04/02 11:48 PM, Brinkman, Theodore
([EMAIL PROTECTED]) wrote:

> I've got an include file that provides the basic framework for every page on
> my site, and at the bottom of each page, I want to spit out when the page
> was last updated.  I used $PHP_SELF inside the include file, and got the
> include file's path.  Is there a variable equivalent to $PHP_SELF that
> returns the path for the file that is being executed?
> 
> Basically, if I'm running index.php, and I include template.php is there any
> way, from inside template.php, to get index.php short of passing it as a
> parameter?
> 
> - Theo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] $PHP_SELF

2002-04-01 Thread Ralph Guzman

Try "mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 6:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP] $PHP_SELF

SysInfo: Apache/1.3.24 (Win32) PHP/4.1.3-dev

I have a question that could be Apache, could be php, but I'm so new to this
I have to ask: what is wrong with my code for the form action?  Apache does
not recognize the " METHOD=POST>
   SSN: 
   First Name:  
   Last Name:   
   Employer:
   Comments:
   
   
   
   

Unable to connect to the database server at this
time." );
  exit();
   }

   //  Select the Alumni db
   if(! @mysql_select_db("Alumni") ) {
  echo( "Unable to locate the Alumni db at this time." );
  exit();
   }

   // If an alumni information record has been submitted

if ("SUBMIT" == $submitalumni) {
  $sql = "INSERT INTO Alumni SET " .
  "SSN='$ssn', " .
  "FIRST_NAME='$firstname', " .
  "LAST_NAME='$lastname', " .
  "EMPLOYER='$employer', " .
  "COMMENTS='$comments' ";
  if (mysql_query($sql)) {
echo( "Your alumni information has been added.");
  } else {
echo( "Error adding submitted alumni information: " .
 mysql_error() . "");
  }
}
echo(" Here are all the Alumni in our database: ");

// Request all alumni entries
$result=mysql_query(
"SELECT * from alumni");
if (!$result) {
   echo( "Error performing query: " . mysql_error() . "");
   exit();
}
// display alumni info in paragraph form
while ( $row = mysql_fetch_array($result) ) {
echo( "" . $row["SSN"] . "");
}

?>


THANKS for your help!  - Kirk



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF on include file

2002-03-20 Thread José León Serna

Hello:
> echo __FILE__;
> will show the current file name
Oops! Thanks! ;-))

Regards.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF on include file

2002-03-20 Thread Wolfram Kriesing

On Wednesday 20 March 2002 10:12, José León Serna wrote:
> Hello:
> > try it with __FILE__
> > you might have to work a little on the resulting string, but it at least
> > delivers the current file's name
>
> What is __FILE__, a global var, an environment variable? Could you put a
> simple example?

print( __FILE__ );
echo __FILE__;
will show the current file name

-- 
Wolfram

... translating template engine 
  http://sf.net/projects/simpletpl

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF on include file

2002-03-20 Thread José León Serna

Hello:
> try it with __FILE__
> you might have to work a little on the resulting string, but it at least
> delivers the current file's name
What is __FILE__, a global var, an environment variable? Could you put a
simple example?

Regards and thanks for your quick answer.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF in include files

2002-03-12 Thread Lars Torben Wilson

On Tue, 2002-03-12 at 15:17, David Johansen wrote:
> Here's the chunk of code in the include file that gave me that. I should
> have put it with the original post:

Ach. Well, $PHP_SELF is in the global scope, so you will either need to 
use 'global $PHP_SELF;' at the beginning of your function, or reference
it as $GLOBALS['PHP_SELF']. If you do one, you don't need to do the 
other. If you're using PHP 4.1.0 or later, just use
$_SERVER['PHP_SELF'];

>  function questions()
> {

 // Add this here, or use one of the next ones below.
 global $PHP_SELF;

> ?>
> U face="Times New Roman" size="2">
> 
>  color="#CC">Questions 
> size="2">
> Insert questions here.
>  }
> ?>
> 
> Thanks,
> Dave


Good luck!

Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF in include files

2002-03-12 Thread Jan Rademaker

On Tue, 12 Mar 2002, David Johansen wrote:

you might try 
global $PHP_SELF;
in that function...

> Here's the chunk of code in the include file that gave me that. I should
> have put it with the original post:
> 
>  function questions()
> {
> ?>
> U face="Times New Roman" size="2">
> 
>  color="#CC">Questions 
> size="2">
> Insert questions here.
>  }
> ?>
> 

-- 
Jan Rademaker <[EMAIL PROTECTED]>
http://www.ottobak.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] $PHP_SELF in include files

2002-03-12 Thread Jason Murray

>  function questions()
> {
[snip]
>  }
> ?>

$PHP_SELF is unknown to the function "questions()".

You'll need to add "global $PHP_SELF" at the top of the function.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF in include files

2002-03-12 Thread Lars Torben Wilson

On Tue, 2002-03-12 at 15:13, David Johansen wrote:
> I'm doing exactly what you said and here's what it says when I call
> $PHP_SELF in the include file:
> 
> http://12.254.227.149/Warning:%20%20Undefined%20variable:%20%20PH
> P_SELF%20in%20c:/inetpub/wwwroot/pages.inc%20on%20line%2035 >?page=questions

You probably have register_globals turned off, as it should be. In 
versions of PHP from 4.1.0 onward, it's off by default; see 
http://www.php.net/release_4_1_0.php for more information.

In short, try $_SERVER['PHP_SELF'] and see what you get.


Hope this helps,

Torben

> "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message
> 1015974570.2134.94.camel@ali">news:1015974570.2134.94.camel@ali...
> > On Tue, 2002-03-12 at 15:02, David Johansen wrote:
> > > Is there a way that I can use $PHP_SELF in include files, so that the
> > > function will use the URL of the php script that calls the include file?
> > > Thanks,
> > > Dave
> >
> > If a.php includes b.php, and you check $PHP_SELF in b.php, it should
> > give you the path to a.php. What result are you getting?
> >
> >
> > --
> >  Torben Wilson <[EMAIL PROTECTED]>
> >  http://www.thebuttlesschaps.com
> >  http://www.hybrid17.com
> >  http://www.inflatableeye.com
> >  +1.604.709.0506
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF in include files

2002-03-12 Thread David Johansen

Here's the chunk of code in the include file that gave me that. I should
have put it with the original post:


U

Questions
Insert questions here.


Thanks,
Dave
"Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message
1015974570.2134.94.camel@ali">news:1015974570.2134.94.camel@ali...
> On Tue, 2002-03-12 at 15:02, David Johansen wrote:
> > Is there a way that I can use $PHP_SELF in include files, so that the
> > function will use the URL of the php script that calls the include file?
> > Thanks,
> > Dave
>
> If a.php includes b.php, and you check $PHP_SELF in b.php, it should
> give you the path to a.php. What result are you getting?
>
>
> --
>  Torben Wilson <[EMAIL PROTECTED]>
>  http://www.thebuttlesschaps.com
>  http://www.hybrid17.com
>  http://www.inflatableeye.com
>  +1.604.709.0506
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF in include files

2002-03-12 Thread David Johansen

I'm doing exactly what you said and here's what it says when I call
$PHP_SELF in the include file:

http://12.254.227.149/Warning:%20%20Undefined%20variable:%20%20PH
P_SELF%20in%20c:/inetpub/wwwroot/pages.inc%20on%20line%2035?page=questions


"Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message
1015974570.2134.94.camel@ali">news:1015974570.2134.94.camel@ali...
> On Tue, 2002-03-12 at 15:02, David Johansen wrote:
> > Is there a way that I can use $PHP_SELF in include files, so that the
> > function will use the URL of the php script that calls the include file?
> > Thanks,
> > Dave
>
> If a.php includes b.php, and you check $PHP_SELF in b.php, it should
> give you the path to a.php. What result are you getting?
>
>
> --
>  Torben Wilson <[EMAIL PROTECTED]>
>  http://www.thebuttlesschaps.com
>  http://www.hybrid17.com
>  http://www.inflatableeye.com
>  +1.604.709.0506
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF in include files

2002-03-12 Thread Lars Torben Wilson

On Tue, 2002-03-12 at 15:02, David Johansen wrote:
> Is there a way that I can use $PHP_SELF in include files, so that the
> function will use the URL of the php script that calls the include file?
> Thanks,
> Dave

If a.php includes b.php, and you check $PHP_SELF in b.php, it should 
give you the path to a.php. What result are you getting?


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP_SELF Undefined

2002-02-19 Thread Lars Torben Wilson

On Tue, 2002-02-19 at 05:14, Ford, Mike [LSS] wrote:
> > -Original Message-
> > From: Matt [mailto:[EMAIL PROTECTED]]
> > Sent: 18 February 2002 23:30
> > To: Lars Torben Wilson
> > 
> > >   $foo = "This page is $_SERVER[PHP_SELF]";

[snip]

> > Can you expand on why the first option isn't generally 
> > acceptable?
> 
> Another reason, as I understand it (and I'm sure Torben will correct 
> me if I'm wrong!), is that in the version without quotes, PHP_SELF is
taken as the name of a constant -- which, as it happens to be undefined,
PHP very kindly assumes you intended to be the equivalent string
'PHP_SELF'.  This is bad for two reasons: (1) the PHP compiler is doing
avoidable extra work to get the desired result; (2) if you just happen,
at a later date, to define a constant of that name, your result will
suddenly be wrong (unlikely with PHP_SELF, I admit, but less so with
something like, say, MAX_SIZE).  Even though this is only a theoretical
danger of low probability, the principles of good defensive programming
would suggest that you nonetheless avoid it with a vengeance!!
> 
> Cheers!
> 
> Mike

You're very right, but even worse than constant collisions are the 
keyword collisions, as far as WTF factor goes:

 'Select an option',
   'option1' => 'First option',
   'option2' => 'Second option');
echo $array[default]; // Parse error.
?>

This one has come up a number of times. 


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP_SELF Undefined

2002-02-19 Thread Ford, Mike [LSS]

> -Original Message-
> From: Matt [mailto:[EMAIL PROTECTED]]
> Sent: 18 February 2002 23:30
> To: Lars Torben Wilson
> 
> >   $foo = "This page is $_SERVER[PHP_SELF]";
> >
> > Or, better:
> >
> >   $foo = "This page is {$_SERVER['PHP_SELF']}";
> >
> > You do have to concat to do this in single-quoted (noninterpolated)
> > strings, though.
> >
> >
> http://www.php.net/manual/en/language.types.string.php#languag
> e.types.string
> .parsing
> 
> Can you expand on why the first option isn't generally 
> acceptable?

Another reason, as I understand it (and I'm sure Torben will correct me if I'm 
wrong!), is that in the version without quotes, PHP_SELF is taken as the name of a 
constant -- which, as it happens to be undefined, PHP very kindly assumes you intended 
to be the equivalent string 'PHP_SELF'.  This is bad for two reasons: (1) the PHP 
compiler is doing avoidable extra work to get the desired result; (2) if you just 
happen, at a later date, to define a constant of that name, your result will suddenly 
be wrong (unlikely with PHP_SELF, I admit, but less so with something like, say, 
MAX_SIZE).  Even though this is only a theoretical danger of low probability, the 
principles of good defensive programming would suggest that you nonetheless avoid it 
with a vengeance!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-19 Thread Brad Hubbard

On Tue, 19 Feb 2002 09:50, Narvaez, Teresa did align ASCII characters thusly:
> When I execute the code below, why is PHP_SELF undefined? I will appretiate
> any help on this. I can get its value by:
>  echo $_SERVER["PHP_SELF"];Thanks in advance! -Teresa
>
>
> 
> 
> Feedback
> 
> 
>  $form_block = "
> 
> Your Name:
>
> 
> Your E-Mail Address:
> 
>
> Your Message:
> 
> 
>
> 
>
> 
>
> ";
>
> ?>

I don't know whether this is of any help to you or not, but this works 
perfectly on my system. I suspected it would as I saw nothing wrong, per se, 
with the code.

Cheers,
Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] PHP_SELF Undefined

2002-02-18 Thread Niklas Lampén

I had this problem while running PHP under windows. I solved (well,
rounded :) the problem with $SCRIPT_NAME (if I remember it right) which
gives the very same result.


Niklas


-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]] 
Sent: 19. helmikuuta 2002 8:05
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP_SELF Undefined


> When I execute the code below, why is PHP_SELF undefined? I will
appretiate
> any help on this. I can get its value by:
>  echo $_SERVER["PHP_SELF"];Thanks in advance! -Teresa

Is your PHP install >= version 4.1.0 ?

You can test with a call to phpinfo();

If your version is less than 4.1.0, try the global variable $PHP_SELF
instead.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Greg Donald

> When I execute the code below, why is PHP_SELF undefined? I will
appretiate
> any help on this. I can get its value by:
>  echo $_SERVER["PHP_SELF"];Thanks in advance! -Teresa

Is your PHP install >= version 4.1.0 ?

You can test with a call to phpinfo();

If your version is less than 4.1.0, try the global variable $PHP_SELF
instead.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Matt

> The other reason is that the parser needs help resolving ambiguity with
> more complex expressions inside strings. If you use this syntax all the
> time, you won't get bitten in the butt later.

I've used the ${$var} to resolve the ambiguity of variable variables, but I
wasn't aware that if could solve the problem with arrays within strings.
I've always broke out of the string for the array part, and concatenated the
rest of the string after that.  I thought that was ugly, so of late I had
been using the unquoted index inside strings.

Thanks, Lars, for setting me straight on this.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Erik Price


On Monday, February 18, 2002, at 06:14  PM, Lars Torben Wilson wrote:

> Sorry, but I do have to correct you here--this isn't true. ;) In double-
> quoted strings and heredocs, you can do the following:
>
>   $foo = "This page is $_SERVER[PHP_SELF]";
>
> Or, better:
>
>   $foo = "This page is {$_SERVER['PHP_SELF']}";
>
> You do have to concat to do this in single-quoted (noninterpolated)
> strings, though.

Ah, I had forgotten about that.  I stay away from the first version, and 
completely forgot about the second version.  Ironic, because IIRC it is 
the answer to one of the first questions I posted on this list. (I was 
trying to include mysql_fetch_array elements in print statements and 
didn't want to transfer the value to a scalar beforehand, or 
something! :)


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Lars Torben Wilson

On Mon, 2002-02-18 at 15:29, Matt wrote:
> >   $foo = "This page is $_SERVER[PHP_SELF]";
> >
> > Or, better:
> >
> >   $foo = "This page is {$_SERVER['PHP_SELF']}";
> >
> > You do have to concat to do this in single-quoted (noninterpolated)
> > strings, though.
> >
> >
> http://www.php.net/manual/en/language.types.string.php#language.types.string
> .parsing
> 
> Can you expand on why the first option isn't generally acceptable?  I can
> understand there being an issue with spaces in an index, but is there some
> other reason that the latter is prefered?

A couple of reasons. For one, it's just inconsistent in that string
indices should always be quoted--but then not in strings. So people tend
to think that since "$_SERVER[PHP_SELF]" is OK, that $_SERVER[PHP_SELF]
would be OK too--when it's not. It's more of an issue when giving 
examples and writing docs than for coding, really--but it doesn't hurt.

The other reason is that the parser needs help resolving ambiguity with 
more complex expressions inside strings. If you use this syntax all the 
time, you won't get bitten in the butt later. Check this out:

 array('bar' => 'baz'));
echo "My Baz is $array[foo][bar]\n";
echo "My Baz is {$array['foo']['bar']}\n";
?>

Many times I've had to explain why the output is:

My Baz is Array[bar]
My Baz is baz


-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Matt

>   $foo = "This page is $_SERVER[PHP_SELF]";
>
> Or, better:
>
>   $foo = "This page is {$_SERVER['PHP_SELF']}";
>
> You do have to concat to do this in single-quoted (noninterpolated)
> strings, though.
>
>
http://www.php.net/manual/en/language.types.string.php#language.types.string
.parsing

Can you expand on why the first option isn't generally acceptable?  I can
understand there being an issue with spaces in an index, but is there some
other reason that the latter is prefered?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Lars Torben Wilson

On Mon, 2002-02-18 at 15:02, Erik Price wrote:
> 
> On Monday, February 18, 2002, at 05:50  PM, Narvaez, Teresa wrote:
> 
> > When I execute the code below, why is PHP_SELF undefined? I will
> > appretiate
> > any help on this. I can get its value by:
> >  echo $_SERVER["PHP_SELF"];Thanks in advance! -Teresa
> >
> >
> > 
> > 
> > Feedback
> > 
> > 
> >  > $form_block = "
> > 
>   ^
> 
> It hasn't been pulled from the $_SERVER array.  It worked for you when 
> you did it the first way, so try doing it that same way in the code:
> 
> 
> 
> Note that I had to "jump out" of the string and concatenate it to the 
> variable, because PHP doesn't let you just use $_* variables in the 
> middle of a string.  I also made sure to "jump back into" the string to 
> finish the HTML form tag.

Sorry, but I do have to correct you here--this isn't true. ;) In double-
quoted strings and heredocs, you can do the following:

  $foo = "This page is $_SERVER[PHP_SELF]";

Or, better:

  $foo = "This page is {$_SERVER['PHP_SELF']}";

You do have to concat to do this in single-quoted (noninterpolated) 
strings, though.

http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing



Cheers,

Torben

> If you don't like doing it this way, do something like
> 
> $PHP_SELF = $_SERVER['PHP_SELF'];
> $form_block = "";
> 
> 
> HTH
> 
> Erik

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Erik Price


On Monday, February 18, 2002, at 05:50  PM, Narvaez, Teresa wrote:

> When I execute the code below, why is PHP_SELF undefined? I will
> appretiate
> any help on this. I can get its value by:
>  echo $_SERVER["PHP_SELF"];Thanks in advance! -Teresa
>
>
> 
> 
> Feedback
> 
> 
>  $form_block = "
> 
  ^

It hasn't been pulled from the $_SERVER array.  It worked for you when 
you did it the first way, so try doing it that same way in the code:



Note that I had to "jump out" of the string and concatenate it to the 
variable, because PHP doesn't let you just use $_* variables in the 
middle of a string.  I also made sure to "jump back into" the string to 
finish the HTML form tag.

If you don't like doing it this way, do something like

$PHP_SELF = $_SERVER['PHP_SELF'];
$form_block = "";


HTH

Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] $PHP_SELF not working -please help

2001-12-19 Thread Steve Edberg

Is the code below in a function? If so, you'll have to globalize $PHP_SELF:

function your_function() {
global $PHP_SELF;

...
echo $PHP_SELF;
..
}

alternatively, you could do

function your_function() {

...
echo $GLOBALS['PHP_SELF'];
..
}

To the best of my knowledge, PHP_SELF is set regardless of the 
register_globals configuration setting, but I'm not 100% sure.

-steve



At 11:13 AM + 12/19/01, Caleb Carvalho wrote:
>Hi there,
>
>I have created a script that is suppose to get some input from
>user and display back, and i have the following method
>
>
>
>so i have a script that if login fails it will ask the user
>to register,
>
>
>if(!$username) {
>  session_unregister("userid");
>  session_uregister("userpassword");
>  echo "Authorisation Failed." .
>   "you must enter a valid credentials.".
>   "try again.\n";
>echo "Login";
>echo "If you're not a member please regsiter.\n";
>echo "Membership";
>exit;
>}
>else echo "welcome, $username!";
>
>
>Now for some strange reasons it tries to access my web direcorty 
>that does not contain any file, and i get the 404 page not found 
>error.
>
>any help would do,
>
>Thanks
>
>Caleb
>


-- 
++
| Steve Edberg  [EMAIL PROTECTED] |
| University of California, Davis  (530)754-9127 |
| Programming/Database/SysAdmin   http://pgfsun.ucdavis.edu/ |
++
| "Restriction of free thought and free speech is the most dangerous of  |
| all subversions. It is the one un-American act that could most easily  |
| defeat us."|
| - Supreme Court Justice (1939-1975) William O. Douglas |
++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF NEW.....?????Continue2

2001-09-04 Thread David Otton

On Mon, 3 Sep 2001 17:15:25 -0700, you wrote:

>So, with the PHP_self (in my hangman game) I probably can send the value of
>my variable to the same page. now my next question is:
>
>How do i maintain the content of the page which is build based on the value
>passed from the previous submision? Do I confuse you know?

I think this is what you are asking for :

The string entered was : $input";
} else {
/* page does not exist, so we should display the form */
?>


  
  Input : 
  




(Caution - I haven't tested this... could be typos)

If you want multiple pages, you can do this:

if (!isset($page)) {
/* do page 1 */
} else {
switch($page) {
case '1' :
/* do page 2 */
break;
case '2' :
/* do page 3 */
break;
default :
/* someone's messing with the URL string */
break;
}
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF NEW.....?????Continue2

2001-09-03 Thread Ardani Sarjito

Hi again!

Thank you for those who have reply my email.

Actually I'm trying to make a hangman game for my students.

I have seen one game written using PHP_SELF but I can't understand who it
works.

So, with the PHP_self (in my hangman game) I probably can send the value of
my variable to the same page. now my next question is:

How do i maintain the content of the page which is build based on the value
passed from the previous submision? Do I confuse you know?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF NEW.....?????Continue

2001-09-03 Thread Jason Murray

> my next question is: how does it work when I use PHP_SELF to 
> send a value of a variable to the same page?

You use it to point your  there.






Now, if the file this form is in gets renamed from foo.php
to bar.php, the form won't break.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF NEW.....?????Continue

2001-09-03 Thread Ardani Sarjito

Thanks for your quick reply.

my next question is: how does it work when I use PHP_SELF to send a value of
a variable to the same page?

Thanks!

Ardani


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF NEW.....?????

2001-09-03 Thread David Robley

On Tue,  4 Sep 2001 08:58, Ardani Sarjito wrote:
> hi!
>
> I have tried to undersatand the usage of PHP_SELF but I still don't get
> it. Could anybody please explain it in simple palin English to this
> poor slow guy who has just learn PHP?
>
> Thank you so much for reviewing this email.
>
> I'm just tring to make a game which require this function but luck is
> not on my side at the moment.
>
> Ardani

>From the docs:

PHP_SELF
The filename of the currently executing script, relative to the document 
root. If PHP is running as a command-line processor, this variable is not 
available.


So it returns the name of the current script. For the simplest example, 
try the following:



-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Any closet is a walk-in closet if you try hard enough.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Alexander Skwar

So sprach »Arcadius  A.« am 2001-08-31 um 17:36:51 -0700 :
> Would this work ?

Kinda, but not really.

If you want to do this, you've got to stuff it all in one function, like
so:

function dunno($mandatory, $optional1 = NULL, $opt2 = NULL){
if (NULL === $optional1){
// behave, as if only $mandatory is set
echo 'mandatory is: ' . $mandatory;
return;
}
if (NULL === $optional2){
// behave, as if $man. and $opt1 have set
echo 'mand is : ' . $mandatory;
echo 'opt1 is : ' . $optional1;
return;
}
// neither $opt1 nor $opt2 are null
echo 'mand is : ' . $mandatory;
echo 'opt1 is : ' . $optional1;
echo 'opt2 is : ' . $opt2;
return;
}

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 2 days 2 hours 31 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Arcadius A.

Ok .I see Thanks to you both !
Have a nice weekend 
Arcad


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Philip Olson


> One of the downside of PHP IMHO is, that you do not have to define
> variables.  This leads to a lot of errors.  At least there should be a
> "option", which forces you to define variables, like maybe so:

I've not followed this thread but this is pretty much what E_NOTICE is
for, turn it on in error_reporting and it'll tell you every undefined
variable.  Do this in php.ini or with error_reporting function.  In fact,
one _should_ develop with E_ALL on.

 if ($var) // will produce a Warning if $var is not set

 echo $notset; // ditto

 $arr[somekey] // Warning if constant variable somekey is 
  not defined (i.e. use 'quotes')

 $arr['key']   // Warning if key 'key' not defined

See :

  http://www.php.net/manual/en/phpdevel-errors.php
  http://marc.theaimsgroup.com/?l=php-general&m=99486381324867

Much more can be said, hope the above helps.

Regards,
Philip Olson



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Boget, Chris

> Cool ...
> Now that we're talking about PHP 
> I'd like to ask a question 
> You know the "overloading" function in C++  Is that 
> possible in PHP ?

No, I do not believe so.
 
> Basically , I'd like to define  more than one function having 
> the same name but different number of variables/parameters ... 
> so PHP would know which one I'm calling depending on the 
> numbwer/type of the variables ... exemple :

You can do this with variable parameters.  Something along
these lines:

function myFunc( $requiredVar, $optionalVar1 = "", $optionalVar2 = "" ) {
  echo "$requiredVar\n";

  if( $optionalVar1 ) {
echo "$optionalVar1\n";

  } 
// etc.
}

Alternately, if you need *alot* of optional vars, consider passing
an array and check that.

Chris



Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Arcadius A.

Cool ...
Now that we're talking about PHP 
I'd like to ask a question 
You know the "overloading" function in C++  Is that possible in PHP ?

Basically , I'd like to define  more than one function having the same name
but different number of variables/parameters ... so PHP would know which one
I'm calling depending on the numbwer/type of the variables ...
exemple :





Would this work ?

Thanks...

- Original Message -
From: "Alexander Skwar" <[EMAIL PROTECTED]>
To: "Boget, Chris" <[EMAIL PROTECTED]>
Cc: "Arcadius A." <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 8:21 AM
Subject: Re: [PHP] PHP_SELF or REQUEST_URI within Function ?


> So sprach »Boget, Chris« am 2001-08-31 um 10:22:28 -0500 :
> > True.  But take the following function:
> >
> > function processLotsOfFormVars() {
> >   global $fieldOne, $fieldTwo, $fieldThree, $fieldFour;
> >   global $fieldFive, $fieldSix, $fieldSeven;
> >   global $PHP_SELF, $REQUEST_URI;
> >   global $HTTP_REFERER;
> >
> >   echo "Field One is: $fieldOne\n";
> >   echo "Field Two is: $fieldTwo\n";
> > // etc
> > }
> >
> > OR you can do it this way:
> >
> > function processLotsOfFormVars() {
> >   echo "Field One is: $GLOBALS[fieldOne]\n";
> >   echo "Field Two is: $GLOBALS[fieldTwo]\n";
> > // etc
> > }
>
> Uh?  I don't see it.  The "matching" function 1 is:
>
> function processLotsOfFormVars() {
> global $fieldOne;
> global $fieldTwo;
>
> echo "Field One is: $fieldOne\n";
> echo "Field Two is: $fieldTwo\n";
> }
>
> this quite doesn't look as intimidating as the piece you wrote.  And
> even if there are 10 lines of 'global', I still like it a lot better,
> because it CLEARLY shows which form vars are going to be used.
>
> One of the downside of PHP IMHO is, that you do not have to define
> variables.  This leads to a lot of errors.  At least there should be a
> "option", which forces you to define variables, like maybe so:
>
> dim $some_var;
>
> this leads to easier readable code IMHO.
>
> > variables in a function.  Plus, if the function gets large,
> > it's easier to see where the value is coming from by using
> > the $GLOBALS variable.
>
> Now, that's the point I'm arguing here.  I don't think so.
>
> Alexander Skwar
> --
> How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
> Homepage: http://www.digitalprojects.com   |   http://www.iso-top.de
>iso-top.de - Die günstige Art an Linux Distributionen zu kommen
> Uptime: 2 days 2 hours 10 minutes
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Boget, Chris

> One of the downside of PHP IMHO is, that you do not have to define
> variables.  This leads to a lot of errors.  At least there should be a
> "option", which forces you to define variables, like maybe so:
>   dim $some_var;

I definitely agree there.  I've been bitten by this bug more times
than I can count.  Granted, it's always been my fault, but it would
have been nice to have something there to say "hey, this variable
hasn't been defined".  I know you can make PHP do this if you set
the error checking very, very high but in doing so, you are also
opening up another bucket of worms that you don't always need
to deal with.

> > variables in a function.  Plus, if the function gets large, 
> > it's easier to see where the value is coming from by using
> > the $GLOBALS variable.
> Now, that's the point I'm arguing here.  I don't think so.

This is definitely a matter of coding style.  Neither of us are
wrong, just a matter of preference.  In replying, I was simply
offering alternatives so that Arcadius would know all options
open to him.  I wasn't trying to say your way was erroneous
and if I came off that way, my apologies.

Chris



Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Alexander Skwar

So sprach »Boget, Chris« am 2001-08-31 um 10:22:28 -0500 :
> True.  But take the following function:
> 
> function processLotsOfFormVars() {
>   global $fieldOne, $fieldTwo, $fieldThree, $fieldFour;
>   global $fieldFive, $fieldSix, $fieldSeven;
>   global $PHP_SELF, $REQUEST_URI;
>   global $HTTP_REFERER;
> 
>   echo "Field One is: $fieldOne\n";
>   echo "Field Two is: $fieldTwo\n";
> // etc
> }
> 
> OR you can do it this way:
> 
> function processLotsOfFormVars() {
>   echo "Field One is: $GLOBALS[fieldOne]\n";
>   echo "Field Two is: $GLOBALS[fieldTwo]\n";
> // etc
> }

Uh?  I don't see it.  The "matching" function 1 is:

function processLotsOfFormVars() {
global $fieldOne;
global $fieldTwo;

echo "Field One is: $fieldOne\n";
echo "Field Two is: $fieldTwo\n";
}

this quite doesn't look as intimidating as the piece you wrote.  And
even if there are 10 lines of 'global', I still like it a lot better,
because it CLEARLY shows which form vars are going to be used.

One of the downside of PHP IMHO is, that you do not have to define
variables.  This leads to a lot of errors.  At least there should be a
"option", which forces you to define variables, like maybe so:

dim $some_var;

this leads to easier readable code IMHO.

> variables in a function.  Plus, if the function gets large, 
> it's easier to see where the value is coming from by using
> the $GLOBALS variable.

Now, that's the point I'm arguing here.  I don't think so.

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 2 days 2 hours 10 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Arcadius A.

RE: [PHP] PHP_SELF or REQUEST_URI within Function ?Ok Men !!!. Now I see  
thanks alot for the inputs ! :o))

Arcad


  - Original Message - 
  From: Boget, Chris 
  To: 'Alexander Skwar' 
  Cc: Arcadius A. ; [EMAIL PROTECTED] 
  Sent: Friday, August 31, 2001 8:22 AM
  Subject: RE: [PHP] PHP_SELF or REQUEST_URI within Function ?


  > > Or, so you don't have to specify all the variables you are using 
  > > as globals (especially if you are using *alot* of them), you can 
  > > use: 
  > > $GLOBALS[SCRIPT_FILENAME]; 
  > What's the gain?  'global ' has 7 characters, whereas '$GLOBALS[]' has 
  > 10 characters.  So, you don't type less.  And with using global(), the 
  > code is more orderly, and thus easier to read. 

  True.  But take the following function: 

  function processLotsOfFormVars() { 
global $fieldOne, $fieldTwo, $fieldThree, $fieldFour; 
global $fieldFive, $fieldSix, $fieldSeven; 
global $PHP_SELF, $REQUEST_URI; 
global $HTTP_REFERER; 

echo "Field One is: $fieldOne\n"; 
echo "Field Two is: $fieldTwo\n"; 
  // etc 
  } 

  OR you can do it this way: 

  function processLotsOfFormVars() { 
echo "Field One is: $GLOBALS[fieldOne]\n"; 
echo "Field Two is: $GLOBALS[fieldTwo]\n"; 
  // etc 
  } 

  I've done it both ways.  I'm not advocating using 
  "$GLOBALS[var_name];" over "global $var_name", 
  just that it is an alternative if you are using alot of global 
  variables in a function.  Plus, if the function gets large, 
  it's easier to see where the value is coming from by using 
  the $GLOBALS variable. 
  That's all I was saying. 

  Chris 




RE: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Boget, Chris

> > Or, so you don't have to specify all the variables you are using 
> > as globals (especially if you are using *alot* of them), you can 
> > use:
> > $GLOBALS[SCRIPT_FILENAME];
> What's the gain?  'global ' has 7 characters, whereas '$GLOBALS[]' has
> 10 characters.  So, you don't type less.  And with using global(), the
> code is more orderly, and thus easier to read.

True.  But take the following function:

function processLotsOfFormVars() {
  global $fieldOne, $fieldTwo, $fieldThree, $fieldFour;
  global $fieldFive, $fieldSix, $fieldSeven;
  global $PHP_SELF, $REQUEST_URI;
  global $HTTP_REFERER;

  echo "Field One is: $fieldOne\n";
  echo "Field Two is: $fieldTwo\n";
// etc
}

OR you can do it this way:

function processLotsOfFormVars() {
  echo "Field One is: $GLOBALS[fieldOne]\n";
  echo "Field Two is: $GLOBALS[fieldTwo]\n";
// etc
}

I've done it both ways.  I'm not advocating using 
"$GLOBALS[var_name];" over "global $var_name",
just that it is an alternative if you are using alot of global 
variables in a function.  Plus, if the function gets large, 
it's easier to see where the value is coming from by using
the $GLOBALS variable.
That's all I was saying.

Chris



Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Alexander Skwar

So sprach »Boget, Chris« am 2001-08-31 um 10:04:49 -0500 :
> Or, so you don't have to specify all the variables you are using 
> as globals (especially if you are using *alot* of them), you can 
> use:
> 
> $GLOBALS[SCRIPT_FILENAME];

What's the gain?  'global ' has 7 characters, whereas '$GLOBALS[]' has
10 characters.  So, you don't type less.  And with using global(), the
code is more orderly, and thus easier to read.

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 2 days 2 hours 0 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Boget, Chris

> So sprach »Arcadius  A.« am 2001-08-31 um 05:27:04 -0700 :
> > $u = $SCRIPT_FILENAME;
> Because you did not define $SCRIPT_FILENAME anywhere.  If you want to
> access the global variable, you've got to say so:
> global $SCRIPT_FILENAME;

Or, so you don't have to specify all the variables you are using 
as globals (especially if you are using *alot* of them), you can 
use:

$GLOBALS[SCRIPT_FILENAME];

Chris



Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Alexander Skwar

So sprach »Arcadius  A.« am 2001-08-31 um 05:27:04 -0700 :
> $u = $SCRIPT_FILENAME;

Because you did not define $SCRIPT_FILENAME anywhere.  If you want to
access the global variable, you've got to say so:

global $SCRIPT_FILENAME;

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 2 days 1 hour 46 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-31 Thread Arcadius A.

Thanks  Jack 

arcad.

"Jack Dempsey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> you have to use $GLOBALS["SCRIPT_FILENAME"]
>
> jack
>
> "Arcadius A." wrote:
>
> > Hello !
> > Why this script   prints an empty string(it prints nothing) as the
value of
> > the variable "u" ?
> > This happens even if  $REQUEST_URI or PHP_SELF is used instead of
> > SCRIPT_FILENAME .
> > Thanks...
> >
> >  > function menu( $theurl)
> > {
> > //global $u ;
> > $u = $SCRIPT_FILENAME;
> > echo $u;
> > echo $theurl;
> > }
> > ?>
> >
> > Hello there !!!
> >
> > 
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-30 Thread Jason Murray

>  function menu( $theurl)
> {
> //global $u ;
> $u = $SCRIPT_FILENAME;
> echo $u;
> echo $theurl;
> }
> ?>
> 
> Hello there !!!
> 
> 

Variable scope.

You need a "global $SCRIPT_FILENAME;" at the top of the function.

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF or REQUEST_URI within Function ?

2001-08-30 Thread Jack Dempsey

you have to use $GLOBALS["SCRIPT_FILENAME"]

jack

"Arcadius A." wrote:

> Hello !
> Why this script   prints an empty string(it prints nothing) as the  value of
> the variable "u" ?
> This happens even if  $REQUEST_URI or PHP_SELF is used instead of
> SCRIPT_FILENAME .
> Thanks...
>
>  function menu( $theurl)
> {
> //global $u ;
> $u = $SCRIPT_FILENAME;
> echo $u;
> echo $theurl;
> }
> ?>
>
> Hello there !!!
>
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-08-14 Thread Chris Worth

Michael,

I've got a program set up like you describe.

the problem is I've noticed that my variables are NOT stable

this is it in a nutshell

1) show 3 options with radio buttons for each

2) based on above  query a database and show a list of the records
(now it just dawned on my that I've been doing this with URL's and that might be the 
problem)

3) show all of the fields in the record to edit as necessary.

4) update the table

1,2,3 work fine.  I save the id number of the record.  however, it isn't persistent.  
IOW, 
suddenly the variable is set to null.

am I just not understanding how php scripts work?

or is my usage of URL's in appropriate.  I'm new to the world of php.

thanks 

chris




On Mon, 30 Jul 2001 17:14:53 -0700, Michael J. Seely wrote:

>I do this sort of thing all the time.  The format I use typically 
>follows this logic.
>
>The PHP file has four IF-ELSEIF-ELSE sections.
>pg=1 or blank  is the initial form
>pg=2 is the error check looking at input values.
>   If it passes, pg is set to 3.
>   If not, set to 1. The advantage of this is the original input 
>values can be saved and displayed with Value= sequences so 
>the use doesn't have to input everything if they make a mistake.  The 
>error can be highlighted with a color or text!!!.
>pg=3 shows a visual verification page. The user can scan the input 
>and use the back button to make changes or click OK to proceed.
>pg=4 is the action step - send an e-mail including the input, post 
>input to a database or ???
>
>The sections are written in this order - 2, 4, 3, 1.
>
>IF($pg="2")
>   { do the error checking
>   e.g., if fields A, B, and C are not blank = OK
>   e.g., if a value is > 100 = not OK
>  IF OK, $pg=3;  IF not OK, $pg=1;
>   }
>ELSEIF($pg="4")
>   { do the action stuff.
>   }
>ELSEIF($pg="3")
>   { show an html page in a nice format showing the input values
>  IF they like it, the form submit button sets pg=4, and 
>uses hidden fields to copy all of the input values to pg 4.
>   }
>ELSE
>   { Show the initial input form.
>   use 
>   }
>
>
>The form can include error check and input tags like this:
>
> { ECHO"Required."; } ?>
>?>
>
>"CHECKED"; } ?> >6
>"CHECKED"; } ?> >7
>
>and so on.  Hope this is useful...
>
>
>
>>Im trying to introduce some logic into a form.I am unsing $PHP_SELF 
>>as the target.
>>
>>
>>I have a text area that the user inputs their age.  What I want is 
>>that if the field is blank, to stop the script and send the user 
>>back to fill in their age.  My problem now is that if I go to the 
>>blank application form, The script interprets the form as being 
>>blank and spits out the error.  Ideal scenario, a blank form is 
>>presented to the user, and when the form is submitted, do the logic 
>>check and act accordingly.  Is it possible using $PHP_SELF as the 
>>target, or do I have to use 2 files: a form 'front end' with the php 
>>logic in the 'backend'??
>>
>>
>>if ($Age = " ") {
>> echo "Please go back and enter your age."; } exit();
>>
>>Thanks
>>Gerard
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>-- 
>
>_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>Michael Seely  408-777-9949
>
>
>
>
> 
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF in a template problem, I think ??

2001-08-06 Thread Phil Latio

Tried this and got parsing errors so " must be correct.


"Richard Baskett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does the manual actually say to use the tags ""?  Or is it the
> normal tags of ""?
>
> > I run a small search engine and adding URL's is a bit of a pain so I
thought
> > I would try to make it easier. Looking around I found a PHP function
called
> > "get_meta_tags" which unsurprisingly, grabs the contents of varoius meta
> > tags. I just want the "description" contents so I first made a
standalone
> > PHP page (http://www.yorkshire-search.co.uk/links/meta-tags.php3) which
> > performs get_meta_tags and uses $PHP_SELF so output is displayed on a
page
> > with the same name. Check it out and you see that works fine (was a
slight
> > problem if no initial URL value set).
> >
> > However, the search engine uses HTML templates and that is where my
problem
> > is.
> >
> > Within the orginal form (add_form.html) was just HTML so I deleted that
and
> > put the above working code between  tags to generate a form.
> > WhenI uploaded it and then entered the page, the form displayed OK but
when
> > I
> > press "generate meta tags" it refuses to output the results into the
boxes.
> > The search engine manual says you can place PHP code within templates as
> > long as they are within  tags so I am now at a bit of loss.
> >
> > This is the add_form.html template if anyone is interested.
> >
> > Add Link
> > 
> > 
> > 
> > 
> > <%error_msg%>
> > 
> >
> > 
> >
> > if ($action == "generate")
> > {
> > print "Insert the following HTML code between the  tags
of
> > your site:";
> > print " > CONTENT=\"$desc\">\n";
> > print "\n";
> > if ($robots == "yes")
> > {
> > print "\n";
> > }
> > if ($refresh == "yes")
> > {
> > print "\n";
> > }
> > if ($copyright == "yes")
> > {
> > print "\n";
> > }
> > if ($author == "yes")
> > {
> > print "\n";
> > }
> > if ($generator == "yes")
> > {
> > print "\n";
> > }
> > if ($language == "yes")
> > {
> > print "\n";
> > }
> > if ($revisit == "yes")
> > {
> > print "\n";
> > }
> > print "";
> > print "Create another set of meta tags";
> >
> >
> > }
> > else
> > {
> > if (isset($getmetafrompage))
> > {
> > $MetaTags = get_meta_tags($getmetafrompage);
> > }
> > $description = $MetaTags["description"];
> > $keywords = $MetaTags["keywords"];
> > $robot = $MetaTags["robot"];
> > $author = $MetaTags["author"];
> > $refresh = $MetaTags["refresh"];
> > $copyright = $MetaTags["copyright"];
> > $revisit = $MetaTags["revisit-after"];
> > $generator = $MetaTags["generator"];
> > $language = $MetaTags["language"];
> >
> > $year = date('y');
> > print "";
> > print "If your page already has META tags you may import and edit
> > them.";
> > print "URL:  > VALUE=\"http://\";>";
> > print " > class=\"button\">";
> >
> > print "";
> > print "";
> > print " > width=\"100%\">  > size=\"2\">Title";
> > print " > face=\"Arial\" size=\"2\">Url";
> > print " > echo=\"$getmetafrompage\"> > face=\"Arial\" size=\"2\">Description";
> > print " > wrap=virtual VALUE=\"$description\">";
> > print " > size=\"2\">Category > size=\"2\"><%category%> > size=\"2\">Contact Name";
> > print " > face=\"Arial\" size=\"2\">Email > size=30> > size=\"2\">Bid";
> > print " > color=\"green\">(optional)  > type=submit name=submit value=\"Add\"
> > class=\"button\">";
> > }
> >
> > 
> >
> > 
> > 
> > 
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF in a template problem, I think ??

2001-08-06 Thread Phil Latio

What I've said.

I might just check out trying out  as they aren't the brightest
bunch of individuals.


- Original Message -
From: "Richard Baskett" <[EMAIL PROTECTED]>
To: "Phil Latio" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, August 06, 2001 1:22 PM
Subject: Re: [PHP] $PHP_SELF in a template problem, I think ??


> Does the manual actually say to use the tags ""?  Or is it the
> normal tags of ""?
>
..


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF in a template problem, I think ??

2001-08-06 Thread Richard Baskett

Does the manual actually say to use the tags ""?  Or is it the
normal tags of ""?

> I run a small search engine and adding URL's is a bit of a pain so I thought
> I would try to make it easier. Looking around I found a PHP function called
> "get_meta_tags" which unsurprisingly, grabs the contents of varoius meta
> tags. I just want the "description" contents so I first made a standalone
> PHP page (http://www.yorkshire-search.co.uk/links/meta-tags.php3) which
> performs get_meta_tags and uses $PHP_SELF so output is displayed on a page
> with the same name. Check it out and you see that works fine (was a slight
> problem if no initial URL value set).
> 
> However, the search engine uses HTML templates and that is where my problem
> is.
> 
> Within the orginal form (add_form.html) was just HTML so I deleted that and
> put the above working code between  tags to generate a form.
> WhenI uploaded it and then entered the page, the form displayed OK but when
> I
> press "generate meta tags" it refuses to output the results into the boxes.
> The search engine manual says you can place PHP code within templates as
> long as they are within  tags so I am now at a bit of loss.
> 
> This is the add_form.html template if anyone is interested.
> 
> Add Link
> 
> 
> 
> 
> <%error_msg%>
> 
> 
> 
> 
> if ($action == "generate")
> {
> print "Insert the following HTML code between the  tags of
> your site:";
> print " CONTENT=\"$desc\">\n";
> print "\n";
> if ($robots == "yes")
> {
> print "\n";
> }
> if ($refresh == "yes")
> {
> print "\n";
> }
> if ($copyright == "yes")
> {
> print "\n";
> }
> if ($author == "yes")
> {
> print "\n";
> }
> if ($generator == "yes")
> {
> print "\n";
> }
> if ($language == "yes")
> {
> print "\n";
> }
> if ($revisit == "yes")
> {
> print "\n";
> }
> print "";
> print "Create another set of meta tags";
> 
> 
> }
> else
> {
> if (isset($getmetafrompage))
> {
> $MetaTags = get_meta_tags($getmetafrompage);
> }
> $description = $MetaTags["description"];
> $keywords = $MetaTags["keywords"];
> $robot = $MetaTags["robot"];
> $author = $MetaTags["author"];
> $refresh = $MetaTags["refresh"];
> $copyright = $MetaTags["copyright"];
> $revisit = $MetaTags["revisit-after"];
> $generator = $MetaTags["generator"];
> $language = $MetaTags["language"];
> 
> $year = date('y');
> print "";
> print "If your page already has META tags you may import and edit
> them.";
> print "URL:  VALUE=\"http://\";>";
> print " class=\"button\">";
> 
> print "";
> print "";
> print " width=\"100%\">  size=\"2\">Title";
> print " face=\"Arial\" size=\"2\">Url";
> print " echo=\"$getmetafrompage\"> face=\"Arial\" size=\"2\">Description";
> print " wrap=virtual VALUE=\"$description\">";
> print " size=\"2\">Category size=\"2\"><%category%> size=\"2\">Contact Name";
> print " face=\"Arial\" size=\"2\">Email size=30> size=\"2\">Bid";
> print " color=\"green\">(optional)  type=submit name=submit value=\"Add\"
> class=\"button\">";
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-08-01 Thread Ralph Guzman

Actually there is no need for you to use exit(); If you choose to use this
method cheking for empty fields one at a time rather than all at once; you
can simplify your code a bit as follows:

If($HTTP_POST_VARS){
if(!$Age) { echo "Please enter your age"; }
elseif(!$Email){ echo "Please enter your email"; }
else

echo "Thanks for your submission";

// continue processing...
...
...
}
}

but in any case, I'm glad I was of help.


-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 01, 2001 12:50 PM
To: PHP
Subject: Re: [PHP] PHP_SELF

Ok, I would like to thank Ralph Guzman & Richard Lynch for your help.
I combined your ideas into my own working example.
Just posting here for archiving/discussion purposes...
// Input some data //
echo "\n";
echo "1.  Age:\n";
echo "   \n";
echo "2.  Email:\n";
echo "   \n";
echo "   \n";
// Start error correction //
if (!$HTTP_POST_VARS) { exit(); }
elseif (!$Age) { echo "Please enter your age.\n"; }
 elseif (!$Email) { echo "Please enter your email.\n"; }
else { echo "Thanks for your submission.\n"; }
// Do what you want with you sanitised strings //
.. :)

Thanks again guys...




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-08-01 Thread Gerard Samuel

Ok, I would like to thank Ralph Guzman & Richard Lynch for your help.
I combined your ideas into my own working example.
Just posting here for archiving/discussion purposes...
// Input some data //
echo "\n";
echo "1.  Age:\n";
echo "   \n";
echo "2.  Email:\n";
echo "   \n";
echo "   \n";
// Start error correction //
if (!$HTTP_POST_VARS) { exit(); }
elseif (!$Age) { echo "Please enter your age.\n"; }
 elseif (!$Email) { echo "Please enter your email.\n"; }
else { echo "Thanks for your submission.\n"; }
// Do what you want with you sanitised strings //
.. :)

Thanks again guys...




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-08-01 Thread Christian Reiniger

On Tuesday 31 July 2001 04:59, Gerard Samuel wrote:

> if ($post = "1" && $Age = " ") {echo "NO";}

"=" is assignment. "==" is comparison

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-08-01 Thread Chris Worth


LOL,

Jon, you just made me realize the typo I had in my script.
Thanks a bunch.  I had some ==, but there were two = which was making my head 
hurt.

thanks for the post.

On Tue, 31 Jul 2001 09:16:26 +0100, Jon Haworth wrote:

>> if ($post = "1" && $Age = " ") {echo "NO";}
>> else {echo "YES";}
>> Now here is what happens.  On a first time view of the page it outputs 
>> 'NO' (Good).  If I dont enter anything in the age field and submit the 
>> form it outputs 'NO' (Good).  If I enter a value into the age field and 
>> submit, it outputs 'NO' (Not Good).
>
>You are assigning these values, not comparing them
>
>$post = "1"// puts "1" in the variable $post
>$post == "1"   // compares $post to "1"
>
>you need to change your code to 
>
>if ($post == "1" && $age == " ") { blah blah blah
>
>HTH
>Jon
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF (code snip)

2001-07-31 Thread Michael J. Seely

HI
You can figure this out so you can work with one file. It's much 
easier to maintain.

Here is an example. It's a simple RSVP form. ***Change line 100 to 
use your own email address to receive the information.  I wrote this 
a while back so I'm not bragging about the html format or coding but 
it works.  It uses a more primitive series of IF's to test the input 
rather than the IF - ELSEIF - ELSE series I described earlier.  In 
this example, remember the first time through, pg is blank (which is 
<2).

Good Luck.



  RSVP









Please fill-in your first name." ; } ;
if($last=="")
 { echo "Please fill-in your family name." ; } ;
if($em=="")
 { echo "Please fill-in your email address." ; 
} ;
 }
 }
?>







 Member 
RSVP 

 Please 
fill-in each line.


 Name
First
Family
E-Mail Address









  





Is this correct?
Use Back-Button to make a change or Send It!




   

 RSVP 

";
echo "Name: $fi $last ";
echo "Email: $em ";
echo "";

?>

   















  






Your RSVP Was Sent! - - Thank You!







  









>Thanks for your input, but I still dont really understand your 
>logic/technique.  If you may, please send me a basic one textarea 
>form, as too how you use this logic.  I guess my main stumbling 
>block is how you move from a blank form ($pg=1) to $pg=2.  I may 
>have to go back to a  2 file format to get this done.  Thanks for 
>listening
>
>Gerard
>
>Michael J. Seely wrote:
>
>>Yes... I like using pg=1, 2, 3, ... to keep track of where I want 
>>the page to go next.  It seems easy that way.  Good Luck.
>>
>>>So far this message and another who mentioned $HTTP_POST_VARS[]
>>>  made a small light go off in my head.  Not enough to get the 
>>>script woriking, but it made me think.  Its not clear, but I sort 
>>>of came up with another way, but I dont know if its doable
>>>.
>>>In my form I have a hidden element called 'post' with a value of 1.
>>>After the end of the form I echo $post.
>>>If its a first time view, there is nothing to output, thats normal.
>>>If I submitted the form it echoes 1, thats to be expected.
>>>Now, Im able to tell if the form has been posted or not.
>>>Enter some logic..
>>>if ($post = "1" && $Age = " ") {echo "NO";}
>>>else {echo "YES";}
>>>Now here is what happens.  On a first time view of the page it 
>>>outputs 'NO' (Good).  If I dont enter anything in the age field 
>>>and submit the form it outputs 'NO' (Good).  If I enter a value 
>>>into the age field and submit, it outputs 'NO' (Not Good).
>>>
>>>Am I heading in the right direction with this??
>>>
>>>
>>>
>>>Michael J. Seely wrote:
>>>
I do this sort of thing all the time.  The format I use typically 
follows this logic.

The PHP file has four IF-ELSEIF-ELSE sections.
pg=1 or blank  is the initial form
pg=2 is the error check looking at input values.
 If it passes, pg is set to 3.
 If not, set to 1. The advantage of this is the original input 
values can be saved and displayed with Value= 
sequences so the use doesn't have to input everything if they 
make a mistake. The error can be highlighted with a color or 
text!!!.
pg=3 shows a visual verification page. The user can scan the 
input and use the back button to make changes or click OK to 
proceed.
pg=4 is the action step - send an e-mail including the input, 
post input to a database or ???

The sections are written in this order - 2, 4, 3, 1.

IF($pg="2")
 { do the error checking
 e.g., if fields A, B, and C are not blank = OK
 e.g., if a value is > 100 = not OK
IF OK, $pg=3;  IF not OK, $pg=1;
 }
ELSEIF($pg="4")
 { do the action stuff.
 }
ELSEIF($pg="3")
 { show an html page in a nice format showing the input values
IF they like it, the form submit button sets pg=4, and 
uses hidden fields to copy all of the input values to pg 4.
 }
ELSE
 { Show the initial input form.
 use 
 }


The form can include error check and input tags like this:

>>> { ECHO"Required."; } ?>
>>>"$val3"; ?>

>>>"CHECKED"; } ?> >6
>>>"CHECKED"; } ?> >7

and so on.  Hope this is useful...

>Im trying to introduce some logic into a form.I am unsing 
>$PHP_SELF as the target.
>
>
>I have a text area that the user inputs their age.  What I want 
>is that if the field is blank, to stop the script and send the 
>user back to fill in their age.  My problem now is that if I go 
>to the blank application form, The script interprets the form as 
>being blank and spits out the error.  Ideal scenario, a blank 
>form is presented to the user, and when the form is submitted, 
>>

RE: [PHP] PHP_SELF

2001-07-31 Thread Jon Haworth

> if ($post = "1" && $Age = " ") {echo "NO";}
> else {echo "YES";}
> Now here is what happens.  On a first time view of the page it outputs 
> 'NO' (Good).  If I dont enter anything in the age field and submit the 
> form it outputs 'NO' (Good).  If I enter a value into the age field and 
> submit, it outputs 'NO' (Not Good).

You are assigning these values, not comparing them

$post = "1"// puts "1" in the variable $post
$post == "1"   // compares $post to "1"

you need to change your code to 

if ($post == "1" && $age == " ") { blah blah blah

HTH
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-07-31 Thread Ralph Guzman





   echo "$formerror";

   " METHOD="post">
   ">
   ">
   
   




-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 3:30 PM
To: PHP
Subject: [PHP] PHP_SELF

Im trying to introduce some logic into a form.I am unsing $PHP_SELF as
the target.


I have a text area that the user inputs their age.  What I want is that
if the field is blank, to stop the script and send the user back to fill
in their age.  My problem now is that if I go to the blank application
form, The script interprets the form as being blank and spits out the
error.  Ideal scenario, a blank form is presented to the user, and when
the form is submitted, do the logic check and act accordingly.  Is it
possible using $PHP_SELF as the target, or do I have to use 2 files: a
form 'front end' with the php logic in the 'backend'??


if ($Age = " ") {
 echo "Please go back and enter your age."; } exit();

Thanks
Gerard


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-07-31 Thread Ralph Guzman

I personally think it is best to display a form error on the form itself,
rather than given them a blank page that shows an error, then have them
click a button or link to go back to the form. Here is somewhat a quick and
dirty example of how I go about forms and error checking. For this example I
am only checking for a required field, you can elaborate on this and check
to see if input for age is numerical, or whatever other type of
error-checking you may need to do:





   " METHOD="post">
   ">
   ">
   
   



Hope this helps.

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 3:30 PM
To: PHP
Subject: [PHP] PHP_SELF

Im trying to introduce some logic into a form.I am unsing $PHP_SELF as
the target.


I have a text area that the user inputs their age.  What I want is that
if the field is blank, to stop the script and send the user back to fill
in their age.  My problem now is that if I go to the blank application
form, The script interprets the form as being blank and spits out the
error.  Ideal scenario, a blank form is presented to the user, and when
the form is submitted, do the logic check and act accordingly.  Is it
possible using $PHP_SELF as the target, or do I have to use 2 files: a
form 'front end' with the php logic in the 'backend'??


if ($Age = " ") {
 echo "Please go back and enter your age."; } exit();

Thanks
Gerard


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-07-30 Thread Gerard Samuel

So far this message and another who mentioned $HTTP_POST_VARS[]
  made a small light go off in my head.  Not enough to get the script 
woriking, but it made me think.  Its not clear, but I sort of came up 
with another way, but I dont know if its doable
.
In my form I have a hidden element called 'post' with a value of 1.
After the end of the form I echo $post.
If its a first time view, there is nothing to output, thats normal.
If I submitted the form it echoes 1, thats to be expected.
Now, Im able to tell if the form has been posted or not.
Enter some logic..
if ($post = "1" && $Age = " ") {echo "NO";}
else {echo "YES";}
Now here is what happens.  On a first time view of the page it outputs 
'NO' (Good).  If I dont enter anything in the age field and submit the 
form it outputs 'NO' (Good).  If I enter a value into the age field and 
submit, it outputs 'NO' (Not Good).

Am I heading in the right direction with this??



Michael J. Seely wrote:

> I do this sort of thing all the time.  The format I use typically 
> follows this logic.
> 
> The PHP file has four IF-ELSEIF-ELSE sections.
>pg=1 or blank  is the initial form
>pg=2 is the error check looking at input values.
> If it passes, pg is set to 3.
> If not, set to 1. The advantage of this is the original input values 
> can be saved and displayed with Value= sequences so the use 
> doesn't have to input everything if they make a mistake.  The error can 
> be highlighted with a color or text!!!.
>pg=3 shows a visual verification page. The user can scan the input 
> and use the back button to make changes or click OK to proceed.
>pg=4 is the action step - send an e-mail including the input, post 
> input to a database or ???
> 
> The sections are written in this order - 2, 4, 3, 1.
> 
> IF($pg="2")
> { do the error checking
> e.g., if fields A, B, and C are not blank = OK
> e.g., if a value is > 100 = not OK
>IF OK, $pg=3;  IF not OK, $pg=1;
> }
> ELSEIF($pg="4")
> { do the action stuff.
> }
> ELSEIF($pg="3")
> { show an html page in a nice format showing the input values
>IF they like it, the form submit button sets pg=4, and uses 
> hidden fields to copy all of the input values to pg 4.
> }
> ELSE
> { Show the initial input form.
> use 
> }
> 
> 
> The form can include error check and input tags like this:
> 
>  { ECHO"Required."; } ?>
>  ?>
> 
>  } ?> >6
>  } ?> >7
> 
> and so on.  Hope this is useful...
> 
> 
> 
>> Im trying to introduce some logic into a form.I am unsing $PHP_SELF as 
>> the target.
>> 
>>
>> I have a text area that the user inputs their age.  What I want is 
>> that if the field is blank, to stop the script and send the user back 
>> to fill in their age.  My problem now is that if I go to the blank 
>> application form, The script interprets the form as being blank and 
>> spits out the error.  Ideal scenario, a blank form is presented to the 
>> user, and when the form is submitted, do the logic check and act 
>> accordingly.  Is it possible using $PHP_SELF as the target, or do I 
>> have to use 2 files: a form 'front end' with the php logic in the 
>> 'backend'??
>>
>>
>> if ($Age = " ") {
>> echo "Please go back and enter your age."; } exit();
>>
>> Thanks
>> Gerard
>>
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-07-30 Thread Michael J. Seely

I do this sort of thing all the time.  The format I use typically 
follows this logic.

The PHP file has four IF-ELSEIF-ELSE sections.
pg=1 or blank  is the initial form
pg=2 is the error check looking at input values.
If it passes, pg is set to 3.
If not, set to 1. The advantage of this is the original input 
values can be saved and displayed with Value= sequences so 
the use doesn't have to input everything if they make a mistake.  The 
error can be highlighted with a color or text!!!.
pg=3 shows a visual verification page. The user can scan the input 
and use the back button to make changes or click OK to proceed.
pg=4 is the action step - send an e-mail including the input, post 
input to a database or ???

The sections are written in this order - 2, 4, 3, 1.

IF($pg="2")
{ do the error checking
e.g., if fields A, B, and C are not blank = OK
e.g., if a value is > 100 = not OK
   IF OK, $pg=3;  IF not OK, $pg=1;
}
ELSEIF($pg="4")
{ do the action stuff.
}
ELSEIF($pg="3")
{ show an html page in a nice format showing the input values
   IF they like it, the form submit button sets pg=4, and 
uses hidden fields to copy all of the input values to pg 4.
}
ELSE
{ Show the initial input form.
use 
}


The form can include error check and input tags like this:

Required."; } ?>


 >6
 >7

and so on.  Hope this is useful...



>Im trying to introduce some logic into a form.I am unsing $PHP_SELF 
>as the target.
>
>
>I have a text area that the user inputs their age.  What I want is 
>that if the field is blank, to stop the script and send the user 
>back to fill in their age.  My problem now is that if I go to the 
>blank application form, The script interprets the form as being 
>blank and spits out the error.  Ideal scenario, a blank form is 
>presented to the user, and when the form is submitted, do the logic 
>check and act accordingly.  Is it possible using $PHP_SELF as the 
>target, or do I have to use 2 files: a form 'front end' with the php 
>logic in the 'backend'??
>
>
>if ($Age = " ") {
> echo "Please go back and enter your age."; } exit();
>
>Thanks
>Gerard
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Michael Seely  408-777-9949




 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-07-30 Thread Phil Driscoll

On Monday 30 July 2001 23:39, Erik H. Mathy wrote:
> W...besides your everyday, run of the mill geek who hates
> Javascript pop-ups, who really disables JavaScript? 95% of the users out
> there don't ever touch the default browser settings. Also, the Javascript
> 1.0 has been around since, what, Netscape 2? It's all you really need for
> form
> validation. Even IE3 supports it pretty well. All the version 5 and 6
> browsers support it, and that's 90% + of the market.
>
> The biggest issue is the AOL browser, which is rather finicky. It can be
> done, though.
>
> It's all a matter of opinion I guess. :)

I don't agree. It's a matter of security. Whatever fancy javascript 
validation you do client side, you MUST validate everything server side as 
though you'd done no client validation, since you can't guarantee that your 
script is being called with sanitised data from on of your own pages.

Cheers
-- 
Phil Driscoll

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-07-30 Thread Richard Baskett

What I did was use javascript to make sure they filled out certain parts of
the form.  I also created a php version in case they disabelled
javascripting.  The way I did this was each input do this:



When they first come into the site the $Username value will be blank, but
once they have submitted the form it will now contain whatever value they
inputted.  Just do an "if" check for all the variables that you want to be
required and then a message variable that appends for each form value they
forgot to fill out and then output the message.

I hope that helps! :)

Rick

> Im trying to introduce some logic into a form.I am unsing $PHP_SELF as
> the target.
> 
> 
> I have a text area that the user inputs their age.  What I want is that
> if the field is blank, to stop the script and send the user back to fill
> in their age.  My problem now is that if I go to the blank application
> form, The script interprets the form as being blank and spits out the
> error.  Ideal scenario, a blank form is presented to the user, and when
> the form is submitted, do the logic check and act accordingly.  Is it
> possible using $PHP_SELF as the target, or do I have to use 2 files: a
> form 'front end' with the php logic in the 'backend'??
> 
> 
> if ($Age = " ") {
> echo "Please go back and enter your age."; } exit();
> 
> Thanks
> Gerard
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-07-30 Thread Erik H. Mathy

W...besides your everyday, run of the mill geek who hates Javascript
pop-ups, who really disables JavaScript? 95% of the users out there don't
ever touch the default browser settings. Also, the Javascript 1.0 has been
around since, what, Netscape 2? It's all you really need for form
validation. Even IE3 supports it pretty well. All the version 5 and 6
browsers support it, and that's 90% + of the market.

The biggest issue is the AOL browser, which is rather finicky. It can be
done, though.

It's all a matter of opinion I guess. :)

- Erik

> -Original Message-
> From: Ryan Fischer [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 30, 2001 5:48 PM
> To: Erik H. Mathy; PHP
> Subject: Re: [PHP] PHP_SELF
>
>
> You wrote:
> > It's generally a whole lot better to do your form value checking with
> > Javascript. It'll be faster and alot less of a waste of your server
> > resources. IMHO, of course. :)
>
> This really isn't that true because if a user has JavaScript disabled,
> or is using a browser that doesn't support it, the error checking will
> simply be ignored, and you'll have been given data that is possibly
> erroneous.
>
> --
>  -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-07-30 Thread Johnson, Kirk

>Ideal scenario, a blank form is presented to the 
> user, and when 
> the form is submitted, do the logic check and act accordingly.  Is it 
> possible using $PHP_SELF as the target, or do I have to use 2 
> files: a 
> form 'front end' with the php logic in the 'backend'??

Yes, this is possible, and commonly done. Just add some logic to determine
if the page is being displayed for the first time, or, if it is being posted
to. An easy way to check this is to see if $HTTP_POST_VARS[] has any
elements. If it does, the form has been posted, so process the form data.

Kirk 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-07-30 Thread Ryan Fischer

You wrote:
> It's generally a whole lot better to do your form value checking with
> Javascript. It'll be faster and alot less of a waste of your server
> resources. IMHO, of course. :)

This really isn't that true because if a user has JavaScript disabled,
or is using a browser that doesn't support it, the error checking will
simply be ignored, and you'll have been given data that is possibly
erroneous.

--
 -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-07-30 Thread Erik H. Mathy

It's generally a whole lot better to do your form value checking with
Javascript. It'll be faster and alot less of a waste of your server
resources. IMHO, of course. :)

> -Original Message-
> From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 30, 2001 5:30 PM
> To: PHP
> Subject: [PHP] PHP_SELF
>
>
> Im trying to introduce some logic into a form.I am unsing $PHP_SELF as
> the target.
> 
>
> I have a text area that the user inputs their age.  What I want is that
> if the field is blank, to stop the script and send the user back to fill
> in their age.  My problem now is that if I go to the blank application
> form, The script interprets the form as being blank and spits out the
> error.  Ideal scenario, a blank form is presented to the user, and when
> the form is submitted, do the logic check and act accordingly.  Is it
> possible using $PHP_SELF as the target, or do I have to use 2 files: a
> form 'front end' with the php logic in the 'backend'??
>
>
> if ($Age = " ") {
>  echo "Please go back and enter your age."; } exit();
>
> Thanks
> Gerard
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] $PHP_SELF name space?

2001-06-24 Thread Jason Lustig

$PHP_SELF is a global variable. You're trying to call it from inside a
function, which won't work unless you declare it as global to the function
(unless you have some thing in the php.ini file set that I don't remember
off the top of my head what it's called which will make all that stuff
global anyway). You've got to do:

class xCrumbs
{
   function Render(){
   global $PHP_SELF;
   echo $PHP_SELF;
}
}
$crumbs = new xCrumbs();
$crumbs->Render();

--Jason


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF name space?

2001-06-24 Thread David Robley

On Mon, 25 Jun 2001 13:08, Kent Sandvik wrote:
> Hi, is there something silly I'm doing (latest PHP 4.0.5), when this
> does not work at all:
> ---
> class xCrumbs
> {
>function Render(){
>echo $PHP_SELF;
> }
> }
> $crumbs = new xCrumbs();
> $crumbs->Render();
>
>
> while
> echo $PHP_SELF;
>
> works just fine? Or something with name spaces and when $PHP_SELF is
> activated?
>
> Thx, Kent

I think you need to declare $PHP_SELF global when referring to it in a 
function...

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   This tagl ineh asto oman yfou rlet terw ords.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF

2001-03-31 Thread elias

please try this:








""Steve Haemelinck"" <[EMAIL PROTECTED]> wrote in message
000401c0b9bb$4aaa1fa0$0200a8c0@shaemeli">news:000401c0b9bb$4aaa1fa0$0200a8c0@shaemeli...
> Anybody got an idea why $PHP_SELF isn't working with me?
>
> I think because I have set my register_globals to off, but how can I get
the
> value of  $PHP_SELF an another way ?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF problems!

2001-03-25 Thread almir

simple
echo basename($PHP_SELF) or base_name check docu
almir
""Erick Papadakis"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
99foro$tig$[EMAIL PROTECTED]">news:99foro$tig$[EMAIL PROTECTED]...
> hi,
>
> i am using my program
>
> http://localhost/test.php
>
> inside this program is a form, which points to $PHP_SELF
>
> but, when i submit this form, the link actually becomes
>
> http://localhost/php/php.exe/test.php
>
> this results in some images not being displayed correctly!
>
> is there anyway i can disable this, and make the PHP SELF same as the
> original?
>
> thanks/erick
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF - internal error?

2001-03-24 Thread almir

is it realy everithing that you get from php or there is something missing ?

i mean usualy it helps basename() or base_name() cant remmember now
try it, but in your case it seems differently

almir

""Tommy"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
99i3q7$57q$[EMAIL PROTECTED]">news:99i3q7$57q$[EMAIL PROTECTED]...
> Hi,
> that's my paht:
>
> ./Webpages/Kalender/php.php
>
> The value of PHP_SELF in php.php is:
>
> /Kalender/php.php/Kalender
>
> How can I fix this Problem? I have PHP 4.04pl1 CGI, Windows ME.
>
> THX Tommy
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF problems!

2001-03-23 Thread PHPBeginner.com

a common problem:

you have compiled PHP as CGI,

make it run as a module, and that problem will disappear.

well, if you really want to have it under CGI, try to check phpinfo() for a
solution



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com






-Original Message-
From: Erick Papadakis [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 24, 2001 12:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP_SELF problems!


hi,

i am using my program

http://localhost/test.php

inside this program is a form, which points to $PHP_SELF

but, when i submit this form, the link actually becomes

http://localhost/php/php.exe/test.php

this results in some images not being displayed correctly!

is there anyway i can disable this, and make the PHP SELF same as the
original?

thanks/erick





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $PHP_SELF vs. functions, arrays and variable

2001-03-16 Thread John Lim

Hi Scott,

Good question! $PHP_SELF is a global variable, so you need to declare it in
functions:

function a()
{ 
global $PHP_SELF;

print $PHP_SELF;
}

John

"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message 
98tjgv$40e$[EMAIL PROTECTED]">news:98tjgv$40e$[EMAIL PROTECTED]...
> Hi!
> 
> I noticed when using $PHP_SELF in the script, you can use only the
> variables.  So, I tried it with the arrays or functions and found that it
> does not work.  So, is $PHP_SELF limited to variables only?
> 
> Scott
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] php_self

2001-02-25 Thread PHPBeginner.com

Here's what to do:

in Apache:
Add (this is all one line)
LoadModule php4_module C:/Webserver/php/sapi/php4apache.dll

then (five lines)
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .phtml
to your httpd.conf.

Remove(comment) Action application ... line



Copy php.ini to C:\Winnt\System32.

Copy msvcrt.dll (from C:\Webserver\PHP\dlls\msvcrt.dll) to C:\Winnt\system32
 - you're almost guranteed to have it, as I did, but just check.

Copy phpts.dll to C:\Winnt\system32.

Startup the Apache service.

At this point, if it worked, you are runniong as a module.

Hopefully this will work :-)


And if it doesn't download a new version of PHP and reinstall it as INSTALL
file says.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Brandon Feldhahn [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 25, 2001 9:27 AM
To: PHPBeginner.com
Subject: Re: [PHP] php_self


well i have windows so how do i recompile it?

"PHPBeginner.com" wrote:

> You have compiled it as CGI, didn't ya?
>
> recompile it as apache's module if you can so apache can give PHP_SELF the
> right value,
>
> Sincerely,
>
>  Maxim Maletsky
>  Founder, Chief Developer
>
>  PHPBeginner.com (Where PHP Begins)
>  [EMAIL PROTECTED]
>  www.phpbeginner.com
>
> -Original Message-
> From: Brandon Feldhahn [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 23, 2001 4:30 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] php_self
>
> Why does php self always show php4/php.exe? how do i take  it off?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




  1   2   >