newbie querystring variables
From: Kelly Soden (ksoden_at_alltel.net)
Date: 12/06/03
- Next message: Hawk: "not sure where to start"
- Previous message: User79: "Problem LDAP and Win2003 AD"
- Next in thread: Geoff Berrow: "Re: newbie querystring variables"
- Reply: Geoff Berrow: "Re: newbie querystring variables"
- Reply: Shawn Wilson: "Re: newbie querystring variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 6 Dec 2003 05:14:39 -0600
I am new to PHP and am having problems using variables passed in a
querystring. For example:
<html>
<head>
<title>submit-vars.html</title>
<body>
<a href="http://localhost/print-vars.php?id=1"> test</a>
</body>
</html>
<html>
<head>
<title>print-vars.php</title>
</head>
<body>
<p>The query string is: <?php echo $_SERVER['QUERY_STRING']; ?></p>
<p><? echo $_GET['id'] ?></p>
<?php printf("\n</br>print variable here->%s",$id); ?>
</body>
</html>
Clicking on the link in submit-vars.html calls print-vars.php producing the
following html source:
<html>
<head>
<title>print-vars.php</title>
</head>
<body>
<p>The query string is: id=test</p>
<p>test</p>
</br>print variable here-></body>
</html>
>From the tutorials I have read, it is my understanding that PHP
automatically create a variable when it sees a name=value pair in a
querystring. Therefore I would expect the word "test" to again be printed
after "print variable here->". The behavior is the same if I submit the
querystring using a form instead of embedding it in a link. The simple PHP
scripts I have written seem to work fine except for this. What am I
missing?
My configuration is as follows:
Apache/1.3.28 (Win32), PHP/4.3.4, on Win 2K.
Apache is running in a command shell, not as a service. I have PHP loading
as a DSO, not as CGI, and have added the following lines in my httpd.conf:
LoadModule php4_module "c:/php/sapi/php4apache.dll"
AddType application/x-httpd-php .php
Thanks!
-Kelly
- Next message: Hawk: "not sure where to start"
- Previous message: User79: "Problem LDAP and Win2003 AD"
- Next in thread: Geoff Berrow: "Re: newbie querystring variables"
- Reply: Geoff Berrow: "Re: newbie querystring variables"
- Reply: Shawn Wilson: "Re: newbie querystring variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|