Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Local Variables in PHP

$
0
0

Grateful for some help in using local variables.

 

I am coding a page for my club's monthly photographic competition. There will be a table of winners (1st, 2nd, 3rd, HC) for each month, so I will have 12 identically constructed tables on the web page.

 

Within each table will be a link to each of the winning pictures: e,g:

<a href="#" onclick="MM_openBrWindow('winningphoto.php?picture=January/slides/After%20the%20Battle.jpg','Competition','scrollbars=yes,resizable=yes,width=900,height=900')">Wembley Stadium</a>

Rather than manually edit this code for every picture every month I would like to use a common template for each month and just declare some variables for each month using the same variable names but to get the appropriate picture to display. e.g:

$month="January";
$1stprizepic="After%20the%20Battle.jpg";
$1stprizetitle="Wembley Stadium";
$1stprizeauthor="Fred Smith";
$2ndprizepic=
$2ndprizetitle=
$2ndprizeauthor=

...and so on
 
then enter the same code in each table but to bring up the appropriate results for the particular month that table represents:
e.g.
<a href="#" onclick="MM_openBrWindow('winningphoto.php?picture=<?php echo "$month"?>/slides/<?php echo "$1stprizepic"?>','Competition','scrollbars=yes,resizable=yes,width=900,height=900')"><?php echo "$1stprizetitle"?> "</a>

(The author's name is not shown in this as it will be a simple echo in another cell)

 

I think I may have a problem with quotes as well....

 

Grateful for any help

 

Brian


Viewing all articles
Browse latest Browse all 13200

Trending Articles