Almost! A few changes and the code looks like this (javascript required ' '):
<?php
if ($photo < 15) {
$newphoto = ($photo + 1);
echo '<input type="button" ' .
'value="Next photo" ' .
'onClick="javascript:location.href=' .
'\'index.php?photo=' .
$newphoto . '.jpg\'" name="button2">';
} else {
echo '<input type="button" value="Return to Start" onClick="index.php">
';
}
?>
According to view source, the counter is working. However, no image shows up when switching to a new photo.
Does this have something to do with my isset code in the first half?
<?
if (!isset($photo)) {
$photo = 1;
$photo_info = array('1' => 'Test Desc',
'2' => 'Desc 2',
'3' => 'Desc 3',
'4' => 'Desc 4',
'5' => 'Desc 5',
'6' => 'Desc 6',
'7' => 'Desc 7',
'8' => 'Desc 8',
'9' => 'Desc 9',
'10' => 'Desc 10',
'11' => 'Desc 11',
'12' => 'Desc 12',
'13' => 'Desc 13',
'14' => 'Desc 14',
'15' => 'Desc 15',);
echo '<img src="photogallery\\' . $photo . '.jpg">' .
'<br>' . $photo_info[$photo] ;
}
?>