Le Mercredi 29 Mai 2002 17:00, Philip Olson a écrit :
> > So my question is : Are there differences between
> > PHP3 and PHP4, in the manner of passing variables to
> > a script ???
> Sort of.  There are many factors for using data from
> outside of PHP, such as forms.  For example, let's
> assume:
>   <form method="GET" action="test.php">
>     <input type="text" name="foo" value="bar">
>     <input type="submit" name="submit">
>   </form>

> Within test.php will be our information, but how
> do we access 'foo' = 'bar' information?  Good
> question, many ways exist, such as:
>   // Works since PHP 3
>   print $HTTP_GET_VARS['foo'];

I haven't tried this one...

>   // Works since PHP 4.1.0
>   print $_GET['foo'];

I tried this  -> $foo=ucfirst($_GET['foo']); // ucfirst() or another func().
Then, my form fields are filled in ( <input type="text" name="foo" 
value="<?php echo $foo; ?>">), but "echo $foo" doesn't work... (????)

>   // Works if the PHP directive register_globals
>   // is ON, which has been default to off since
>   // PHP 4.2.0
>   print $foo;

Good Ol' way :-), funnylly still working on other scripts on the same site 
/server. (?????)

> Most likely you are trying to access $foo while
> register_globals = off.  You may want to discuss
> this topic a little with your host, and ask them
> to turn register_globals back on until everyone
> is happy/ready for this major change.

I'll try phpinfo(); , but I cannot change anything to my provider's config 
file .... :-(

> Is there such a thing as register_globals_runtime()?
> Nope.  But you can (if host allows) use .htaccess to
> modify such directives.  Also consider the functions
> extract() and/or import_request_variables() too.  I
> did post a _version_ of doing this at runtime here:
>   http://bugs.php.net/bug.php?id=17428
> It might help too.  Also read:
>   http://www.php.net/manual/language.variables.predefined.php
> Regards,
> Philip Olson

Thanx, and thanx too to John Holmes....
If you've got time to spend helping me, take a look at my first mail, below, 
maybe it will seem clear to you.... It's not, to me :-(

--------first mail-------------

Helllorgh, <all> !!!

I've got a strange problem...

Look at this pseudo-script (news.php) :

<!-- blah blah //-->
//processing the form
    If (!empty($text) && !empty($title))
        do some stuff to check the posted variables;
        insert into database;
        this includes if-else, etc..., but no functions (so no scope matter
        etc, etc... ;
// diplaying the news
     Display the 5 last news in nice html;
<form action="news.php" method="post" name="form"
   <input type="text" name="text" ....value="<?php echo $text; ?>">
   <input type="text" name="title" ....value="<?php echo $title; ?>">
   <input type="file" ....>
   <INPUT type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"250000\">
   ..... and the submit, plus 1 or 2 others...

Well, this worked fine for nearly a year now, (and still works),  when this
script was named "news.php3", but I wanted to use the "ob_" functions ...
So, a few days ago, I renamed the script in "news.php", added a few lines of
code to add one or two enhancements (I don't think they are a problem), and
now, there is now way to post a "news".
What is happening : I tested this script at home (EasyPHP under windows),
everything worked fine, I was able to post some "news", check for the
correct displaying, correct it if necessary, and then, by checking the
"final version" checkbox, send it definitely.
Well, quite happy at 2 am (:-)), I uploaded it on my provider's server
(Recently upgraded with PHP4.xxx), but there, nothing is working !!!
The script acts as if no (or not enough) field was filled, thus diplaying
the old news, but not the newly posted...
Adding ' echo "\$text : $text<br>\n"; ' shows that the script doesn't see
the posted fields, and the form stays empty (Should display the submitted
values for correction) !!!
The only way to get it to work has been to rename the script in "news.php3",
then commenting the "ob_..." functions (I discovered that extension is
version :-)), and it now works fine !!!
Well, I'd really like to use the "ob_" functions, and simply know where goes
the posted stuff with PHP4... As I've got some other scripts written in PHP4
(".php") with the same kind of programming that work fine on the same server

Finally, i'm making some tests by replacing "$text" and "$title", etc...,
with $_POST["text"], $_POST["title"], as I've read that it is now standard
and secure programming (Can someone confirm, please ??? Are "$vars"
deprecated ???).
Well, the result is nearly the same.... no displaying, but the form stays

Sorry for that LLLLooooong mail, but I tried to tell the maximum, so maybe
one sees immediately the problem...
Thanx, @+++

--------/first mail------------------

 ( °> Nicolas Costes
 //\\  IUT de La Roche / Yon
`-<<  http://luxregina.free.fr

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

Reply via email to