Re: Someone please help me with this PHP script.
| From: | Erik Johnson | Date: | Sun, 18 Dec 2005 15:33:15 +0000 |
| Subject: | Re: Someone please help me with this PHP script. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-227601@lists.php.net to get a copy of this message | ||
Well. Here's an example of the page --
http://lom.game-host.org/uploads/erik/
It is just loading the second page, no matter what. I haven't added the
isset thing yet, but I'll try it. BTW: I'm only 14, so I have yet to use an
older version, and upgrade to a newer PHP. ;-)
Thanks,
Erik Johnson
On 12/18/05, Zareef Ahmed <consultancy@indiaphp.com> wrote:
>
> Hi Johnson,
>
> what is not working in this code?
> what is the problem? It will always execute the first part of if
> condition,
> i.e.
> It will print
>
> <html><head><title>Page One</title></head><body>It
> works!!<br><a
>
> href="http://lom.game-host.org/uploads/erik/index.php?page=two"
> >Nice...</a><
> /body></html>
>
> What you are expecting from this script?
>
>
> One recommendation, it is better to use isset function to check if
> variable
> has been set or not.
>
> Zareef Ahmed
>
> ----- Original Message -----
> From: "Erik Johnson" <budduh@gmail.com>
> To: <php-general@lists.php.net>
> Sent: Saturday, December 17, 2005 11:05 PM
> Subject: [PHP] Someone please help me with this PHP script.
>
>
> I do not know why this isn't working, but it would be very helpful if
> someone looked over it.
>
> <?
> $defaultpage =
> "http://lom.game-host.org/uploads/erik/";
>
> If($page == NULL) {
> $page = "one";
> }
>
> if($page == "one") {
> Echo "<html><head><title>Page
> One</title></head><body>It works!!<br><a
> href=\"" . $defaultpage . "index.php
> ?page=two\">Nice...</a></body></html>";
> }
>
> elseif($page == "two") {
> Echo "<html><head><title>Page
> Two</title></head><body>This is page " .
> $page . " -- <a href=\"" . $defaultpage . "index.php
> ?page=\">;D</a></body></html>";
> }
>
> elseif( ($page != "one") or ($page != "two") or ($page != NULL) ) {
> Echo
> "<html><head><title>Undefined!</title></head><body>page
> isn't
> defined correctly!</body></html>";
> }
>
> if($page == "") {
> Echo
> "<br><br><br><br><br><br><br><br><a
> href=" . $defaultpage . ">Main
> Page..</a>";
> }
> ?>
>
> Thank you,
>
> Erik Johnson
>
>
>
> ====================================================
> PHP Expert Consultancy in Development http://www.indiaphp.com
> Yahoo! : consultant_php MSN : consultancy@indiaphp.com
>
>
>