[thelist] Pass vars to HTML in PHP

Matt Warden mwarden at gmail.com
Sun Apr 9 15:45:33 CDT 2006


On 4/9/06, Ken Moore <psm2713 at hotmail.com> wrote:
> Hi all,
>
> I am creating RSS feeds in tables as here:
>
> <table>
>   <tr>
>     <td bgcolor="#339933">
>
> The feeds work fine. The problem is that I need to color match about 20 to
> 25 different sites. Rather than create 20 different pages that identical
> except for the color, I want to pass in the color, "339933", as a variable
> using PHP. I am pretty certain that this is possible. Please help..

<table>
  <tr>
    <td bgcolor="#<?php echo (empty($_GET['color']) ? '339933' :
$_GET['color']); ?>">

This will give you the default color of #339933, unless there is a
query string variable named 'color':

http://myserver.com/path/myscript.php?color=995732

This will give you a color of #995732

hth,

--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list