RE: [PHP] passing variables to scripts
| From: | John Holmes | Date: | Sun, 28 Apr 2002 17:26:19 +0000 |
| Subject: | RE: [PHP] passing variables to scripts | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94987@lists.php.net to get a copy of this message | ||
Try $_GET["entry_id"] or $HTTP_GET_VARS["entry_id"], depending on your
version of PHP.
---John Holmes...
> -----Original Message-----
> From: Mark Gallagher [mailto:mark@cyberfuddle.com]
> Sent: Sunday, April 28, 2002 4:04 AM
> To: php-general@lists.php.net
> Subject: [PHP] passing variables to scripts
>
> (yes, newbie - but I *have* tried everything I know, I swear)
>
> I'm trying to write a "comments" system for my site (because I think I
> can). Basically, the script receives the ID of a particular entry
(the
> site is a blog) via "?entry_id=<entry_id>". It checks to see if
there's
> a corresponding text file (<entry_id>.txt) and if so, it prints the
> contents of the text file and invites the user to input a comment. If
> not, it prints "no comments" and invites the user... yadda yadda.
>
> Now, unless I'm mistaken, passing the arguments are done like so:
> http://www.foo.com/comments.php?entry_id=test
> Right?
>
> Unfortunately, it doesn't work. That is to say, everything about the
> script works, except recognition of the $entry_id variable. Something
> as simple as: <title>comments for entry "<?php echo("$entry_id");
> ?>"</title> returns "<title>comments for entry
> ""</title>.
>
> Saving the text file's URL to a variable:
> <?php
> $filename = http://www.foo.com/$entry_id; .txt;
> ?>
>
> Doesn't work either.
>
> I had a semi-hunch (brought on by my own inexperience, no doubt) that
> maybe I had to start a session or something on the referring page.
Tried
> that (session_start();), didn't have any effect. Bah.
>
> Can anyone point out what I'm doing wrong?
>
> TIA
>
> --
> Mark Gallagher
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php