Re: PHP problem

by "Rossi Designs" <webmaster(at)rossidesigns.net>

 Date:  Tue, 4 Apr 2000 15:16:00 -0400
 To:  <Reywob(at)aol.com>,
<hwg-languages(at)hwg.org>
 References:  aol
  todo: View Thread, Original
I'd use the isset() function to check if a variable has been passed.

<head>
    <title>Untitled</title>
    <link rel="stylesheet" href="<?php
        if (!isset($css)):
        echo ("http://members.aol.com/reywob/newstyle.css");
        else:
        echo ("$css");
        endif;
        ?>" type="text/css">
</head>




Rossi Designs
PO Box 1084
Holly Hill, FL 32125-1084
Phone : (904) 226-8979
URL : http://rossidesigns.net
----- Original Message -----
From: <Reywob(at)aol.com>
To: <hwg-languages(at)hwg.org>
Sent: Tuesday, April 04, 2000 1:52 PM
Subject: PHP problem


| Hi,
|
| I'm trying to write my first php script, to pass a variable from page to
page
| and include it in that page, or if there is no variable print an
alternative.
|  This is so that a friend and I can share a couple of pages of our
websites
| with each other.  However I cannot get it to work.  The code is:
|
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
| <head>
|     <title>Untitled</title>
|     <link rel="stylesheet" href="<?php
|         if ($css == 0):
|         echo ("http://members.aol.com/reywob/newstyle.css");
|         else:
|         echo ("$css");
|         endif;
|         ?>" type="text/css">
| </head>
|
|
| <A HREF="variable.php3?css=anything.css">Change the page colour
(hopefully!)</
| A>
|
|
|
|
|
| and you can see it in action at: <A
|
HREF="http://www.narrowgauge.f2s.com/variable.php3">http://www.narrowgauge.f
2s
| .com/variable.php3</A>
|
| Can any of you php wizards tell me what I've done wrong???  Guess I'm not
far
| enough through the book (Professional PHP Programming) yet!
|
| Thanks,
| Peter.
|

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA