Professional Web Applications Themes

[PHP] Still can't pass variable through url - PHP Development

<?php $year=1999; $month=march; echo "<a href=\"http://www.thingamajigger.com/index.php?year=$year&month=$month\" >yeah this is the link</a>"; ?> > -----Original Message----- > From: John Manko [mailto:xeridadelphia.net] > Sent: Friday, August 08, 2003 2:47 AM > To: Martin Towell > Cc: 'Jack'; [email]php-generallists.php.net[/email]; [email]php-windowslists.php.net[/email] > Subject: Re: [PHP] Still can't pass variable through url > > > actually, you might want to urlencode it. > ok, so i doubt that you would need url encoding for $year and $month, > but I'm sure you will playing with more of this in the future, so you > should properly prepare to do so. Note: browsers will do > ...

  1. #1

    Default RE: [PHP] Still can't pass variable through url

    <?php
    $year=1999;
    $month=march;

    echo "<a
    href=\"http://www.thingamajigger.com/index.php?year=$year&month=$month\"
    >yeah this is the link</a>";
    ?>
    > -----Original Message-----
    > From: John Manko [mailto:xeridadelphia.net]
    > Sent: Friday, August 08, 2003 2:47 AM
    > To: Martin Towell
    > Cc: 'Jack'; [email]php-generallists.php.net[/email]; [email]php-windowslists.php.net[/email]
    > Subject: Re: [PHP] Still can't pass variable through url
    >
    >
    > actually, you might want to urlencode it.
    > ok, so i doubt that you would need url encoding for $year and $month,
    > but I'm sure you will playing with more of this in the future, so you
    > should properly prepare to do so. Note: browsers will do
    > formatting for
    > you, but don't rely on it.
    >
    > "page.php?year=" . urlencode($year) . "&month=" . urlencode($month)
    >
    >
    > Martin Towell wrote:
    >
    > >See if changing it to
    > > page.php?year=$year&month=$month
    > >works
    > >
    > >
    > >The separator between the page and the query string is "?"
    > >The separator between each key/value pair is just "&"
    > >
    > >-----Original Message-----
    > >From: Jack [mailto:nedcor4nedcor.com.hk]
    > >Sent: Friday, 8 August 2003 4:30 PM
    > >To: php-generallists.php.net; php-windowslists.php.net
    > >Subject: [PHP] Still can't pass variable through url
    > >
    > >
    > >Dear all
    > >I had set the "register_global=on" and "magic_quotes_runtime=off"
    > >already, but when i click my hyperlink
    > >"page.php?year=$year&?month=$month", it doesn't pass the
    > variable for
    > >?year and ?month to the destination page "page.php" I'm
    > using php 5.0
    > >above , if the same case apply to php4.04, then there is no
    > problem at
    > >all! Can anyone please give me more help on this?
    > >
    > >Thx alot
    > >Jack
    > >
    > >
    > >
    > >
    > >
    >
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    >
    Joe Harman Guest

  2. #2

    Default RE: [PHP] Still can't pass variable through url

    This _might_ be causing you problems...
    $month=march;
    strings should be quoted (unless you've define("march", "march")'ed it...)
    $month='march';

    Martin

    -----Original Message-----
    From: Joe Harman [mailto:joeharmanmedia.com]
    Sent: Friday, 8 August 2003 4:55 PM
    To: [email]php-generallists.php.net[/email]
    Subject: RE: [PHP] Still can't pass variable through url


    <?php
    $year=1999;
    $month=march;

    echo "<a
    href=\"http://www.thingamajigger.com/index.php?year=$year&month=$month\"
    >yeah this is the link</a>";
    ?>
    > -----Original Message-----
    > From: John Manko [mailto:xeridadelphia.net]
    > Sent: Friday, August 08, 2003 2:47 AM
    > To: Martin Towell
    > Cc: 'Jack'; php-generallists.php.net; php-windowslists.php.net
    > Subject: Re: [PHP] Still can't pass variable through url
    >
    >
    > actually, you might want to urlencode it.
    > ok, so i doubt that you would need url encoding for $year and $month,
    > but I'm sure you will playing with more of this in the future, so you
    > should properly prepare to do so. Note: browsers will do
    > formatting for
    > you, but don't rely on it.
    >
    > "page.php?year=" . urlencode($year) . "&month=" . urlencode($month)
    >
    >
    > Martin Towell wrote:
    >
    > >See if changing it to
    > > page.php?year=$year&month=$month
    > >works
    > >
    > >
    > >The separator between the page and the query string is "?"
    > >The separator between each key/value pair is just "&"
    > >
    > >-----Original Message-----
    > >From: Jack [mailto:nedcor4nedcor.com.hk]
    > >Sent: Friday, 8 August 2003 4:30 PM
    > >To: php-generallists.php.net; php-windowslists.php.net
    > >Subject: [PHP] Still can't pass variable through url
    > >
    > >
    > >Dear all
    > >I had set the "register_global=on" and "magic_quotes_runtime=off"
    > >already, but when i click my hyperlink
    > >"page.php?year=$year&?month=$month", it doesn't pass the
    > variable for
    > >?year and ?month to the destination page "page.php" I'm
    > using php 5.0
    > >above , if the same case apply to php4.04, then there is no
    > problem at
    > >all! Can anyone please give me more help on this?
    > >
    > >Thx alot
    > >Jack
    > >
    Martin Towell Guest

Similar Threads

  1. The variable won't pass
    By weswhite7 in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: July 8th, 06:10 AM
  2. how to pass variable in TitleWindow
    By bhavin_kp in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: June 1st, 05:39 PM
  3. Login needs to pass variable
    By *thirtysixsquares* in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 4th, 11:03 AM
  4. How to pass a variable to .t file
    By Rajesh Dorairajan in forum PERL Beginners
    Replies: 3
    Last Post: November 4th, 07:14 PM
  5. Can't Pass variable to other page
    By Kae Verens in forum PHP Development
    Replies: 0
    Last Post: August 7th, 10:28 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139