Reply to Re: The GET-argument

Your name:

Reply:


Posted by Kim Andrι Akerψ on 06/19/06 20:35

Henk Oegema wrote:

> I have just started teaching myself PHP language.
> I'm studying an article about "GET", to pass arguments from one page
> to another.
>
> It is not working the way it is suppose to.
> And I can't figure out what the problem (mistake) is.
>
>
> This file should pass a argument to the file baseball.php
> ======================================================================
> <html>
> <head>
> <title>A GET example, part 1</title>
> </head>
>
> <body>
> <form action="http://192.168.123.100/PHP4/baseball.php" method="GET">
> <p>Root, root, root, for the:<br>
> <select name="Team" size=2>
> <!-- It's a good idea to use the VALUE attribute even though it is
> not mandatory with the SELECT element. In this example, it's
> extremely necessary. -->
> <option value="Cubbies">Chicago Cubs (National League)
> <option value="Pale Hose">Chicago White Sox (American League)
> </select>
> <p><input type="submit">
> </form>
> </body>
> </html>
> ======================================================================
> =
>
> File baseball.php:
> ======================================================================
> = <html>
> <head>
> <title>A GET example, part2</title>
> <style type="text/css">
> <!--
> body {font-size:24pt;}
> -->
> </style>
> </head>
>
> <body>
> <p>Go,
> <?php print("$Team"); ?>
> !
> </body>
> </html>
> ======================================================================
> ====
>
> If the user makes a selection and presses SUBMIT in the first file,
> than the browser put those elements together, without spaces.
> The following URL string should be made:
> http://192.168.123.100/PHP4/baseball.php?Team=Cubbies&Submit=Submit.
> So the output should be: Go, Cubbies!
>
> However, what I get is:
> http://192.168.123.100/PHP4/baseball.php?Team=Cubbies (&Submit=Submit
> is missing !
> My output is: Go, !
>
> The variable output is missing.
> After many hours of searching I still haven't found the problem.
>
> Thanks for any help.
> Henk Oegema

Input fields without a name arent't included in the submitted data.

So, change this:
<p><input type="submit">

To this:
<p><input type="submit" name="Submit" value="Submit">

Also, $Team will only work if register_globals is set to "on" in the
PHP configuration file (php.ini).

A more reliable way is to use this format:
print($_GET["Team"]);

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация