SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Local Server Not Recognizing Variables

    OK, here's a problem I am having:

    I am just started trying to use PHP to create a site. On this forum I found a link to a SitePoint tutorial on how to use PHP/MySQL, and it's great!

    On the following page it is not going correctly:
    http://www.webmasterbase.com/article.php?pid=38&aid=528

    When it gets to the part about using "welcome.php?name=Kevin" and "<?php echo( "Welcome to our Web site, $name!" );?>" to display the person's name, it does not work. The name just does not appear. Nothing appears.

    I tried it uploading it to my host, and it worked. But, I have had no luck on the Apache/PHP/MySQL system set up on my local machine for developing, since I do not want to upload each time to see my results.

    For your help, I have uploaded a copy of the PHPinfo readout from my local computer here:
    http://da-man.com/php-test/phpinfo.html

    If you can help me at all, please do, and if you need any more info or clarification, I can't wait to help you.

    Thanks much!

    Dan "da Man" Ficker
    Webmaster
    http://da-Man.com/
    http://cMusicWeb.com/

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    the reason is that you are running php4.2.1 with register_globals off { good choice... }.

    So you need to modify the code as:

    PHP Code:
    <?php echo( 'Welcome to our Web site, '.$_GET'name' ].'!' ); ?>
    Check the manual for more infos about new superglobals array.

    Last edited by pippo; Jul 25, 2002 at 01:59.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  3. #3
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, if I put register_globals ON (I'm assuming that's in my PHP.ini) then I would get the right result?

    And, was the comment of "good choice" a joke, or is there a reason to keep register_globals off??

    Thanks,

    Dan "da Man"

  4. #4
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I looked at my php.ini and the helpful stuff right in there gave me a good idea why it is a good idea to keep register_globals Off. But, if my host's default is to keep it on, then is there any reason I should not change the setting on my local server (which is just used for development before moving to the host)?

    In other words, would it be better to develop it with register_globals off and still put it up on a system with register_globals on?

    Thanks much!!

    Dan "da Man"

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by DanDaMan
    In other words, would it be better to develop it with register_globals off and still put it up on a system with register_globals on?
    Yes.

  6. #6
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ohhh, is this register_globals new to PHP4??

    I think the tutorial I was reading was made for PHP3. I guess I should find one that is teaching PHP4.

    Thanks,

    Dan "da Man"

  7. #7
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    >> was the comment of "good choice" a joke
    No.

    pippo
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •