Results 1 to 14 of 14

Thread: URL Variables are not working

  1. #1

    Thread Starter
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106

    URL Variables are not working

    I am having a BIG problem. URL Variables are not working.

    an example of this is:

    www.mydomain.com/test.php?myVar=Test

    --- test.php ---

    <%
    echo "The value of myVar is: $myVar";
    %>

    ------------------

    outputs: The value of myVar is:

    What do I need to do? Is there something in a config file I need to change? This is really putting a hurt on my .php development.

    Thanx for the help,
    Brandon
    Master of Cyber Fu - A Temple of Digital Chi

  2. #2
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    you probably upgraded PHP to 4 and up.

    Meaning you can use global variables like that anymore. Try $_REQUEST[MYvar]

  3. #3

    Thread Starter
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106

    auugghhh

    Thanx man.

    Auuugghhhh!!!
    That means allot of code changing.
    I also assume that by changing it, the php code will not be compatible with the older versions. Well... at least my stuff works now.

    Thanks again!
    brandon
    Master of Cyber Fu - A Temple of Digital Chi

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    if you just upgraded to PHP 4.2, then register_globals is turned off by default. Simply turn it back on in your php.ini and all your existing code should work as before

  5. #5
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    only do that if your hosting it yourself. If you are getting hosting from some other company, they will of course not turn it off. Its better anyway.

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    My host lets me edit my own php.ini.

    I don't see how it's better...just means you have to write more code and practically every PHP script in existance has had to have been re-written

    Pretty stupid idea turning them off by default if you ask me

  7. #7
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    its helps me know if it is a global or not, I am very forgetful when it comes to that sort of thing.

  8. #8
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    the globals were turned off because it was a security hazard. also brandito that is not php you are doing it is ASP. php is not <% it is <?

    oh and jsut a hint, more script will be rewritten in the future because mysql_connect() is going bye bye. mwhahahahahahahah

  9. #9
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by phpman
    the globals were turned off because it was a security hazard. also brandito that is not php you are doing it is ASP. php is not <% it is <?

    oh and jsut a hint, more script will be rewritten in the future because mysql_connect() is going bye bye. mwhahahahahahahah
    PHP can be started any number of ways actually

    <? ... ?>
    <?php ... ?>
    <SCRIPT LANGUAGE="php"> ... </SCRIPT>
    <% ... %> (that requires asp_tags on in the ini

    And I hope you're joking about mysql_connect...show me a link

  10. #10
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    http://www.mysql.com/doc/en/mysql_connect.html

    only problem is you are suppose to use mysql_real_connect() but the lastest version of php doesn't even support it.

    and if you do it "<%" that way you are confusing the php parser. there is somehting else but it eludes me at the moment.

    sure it may work but it will expect to parse it as ASP. plus ASP is weak in a *nix OS.

    and I never could get
    <SCRIPT LANGUAGE="php"> ... </SCRIPT>

    to work, sure it may work but I never got it to work.

  11. #11
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    what will we have to do to connect in the new version?

  12. #12
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by phpman
    http://www.mysql.com/doc/en/mysql_connect.html

    only problem is you are suppose to use mysql_real_connect() but the lastest version of php doesn't even support it.
    It really pisses me off when they change the names of functions for no good reason and call the old one "deprecated" despite the fact it's indentical. They're forever doing it...what is the point?!
    and if you do it "<%" that way you are confusing the php parser. there is somehting else but it eludes me at the moment.

    sure it may work but it will expect to parse it as ASP. plus ASP is weak in a *nix OS.

    and I never could get
    <SCRIPT LANGUAGE="php"> ... </SCRIPT>

    to work, sure it may work but I never got it to work.
    I've never actually tried it, but I know you can. I always use <?php...?>

  13. #13

    Thread Starter
    Lively Member Brandito's Avatar
    Join Date
    Nov 2000
    Location
    Here, There, Every Where!
    Posts
    106
    I used the <? I just wrote it wrong on the forum. I must of had an asp relapse.


    mysql_connect... noooo I use that. evil!
    It can't go away. I am too lazy
    Master of Cyber Fu - A Temple of Digital Chi

  14. #14
    Lively Member scoutt's Avatar
    Join Date
    Aug 2002
    Posts
    84
    well it maybe identical but it is suppose to manage memory better and use less resources.

    not much we can do but use the regular one until it finally goes away.
    Just Imagine what you can do with the power of php.

    257 Tutorials and counting.
    529 Snippets and growing.

    Add yours today @
    SnippetLibrary.com

Posting Permissions

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



Click Here to Expand Forum to Full Width