Links in php code
The following code lists countries and associated clubs:
<?php
$Current = $row_clubset['country_id']; // initialise variables
echo '<p>' . $row_clubset['country_id'] . '<blockquote>'; // print the first country and set a block quote.
do{
// if it is not the same country, close the blockquote, print the Country open a new blockquote and print the club name followed by a break
if ($Current<>$row_clubset['country_id']) echo '</blockquote> <p>' . $row_clubset['country_id'] . '</P> <blockquote>'.'Visit the '. $row_clubset['club_name'] . '<br>' ;
// else just print the club name followed by a break
else echo 'Visit the '.$row_clubset['club_name'] . '<br>' ;
// Set the current country to the value of the current country
$Current = $row_clubset['country_id'];
// now get the next record if there are any to get.
} while ($row_clubset = mysql_fetch_assoc($clubset)); ?>
The output is as follows:
Germany
Visit the Berlin Club
Visit the Hanover Club
France
Visit the Paris Club
I need to convert the "Visit" into a link..
The link should be like this:
<a href="viewclubs.php">visit the</a> without a parameter.
And it produces this code, which does create the link and works fine but does not pass a parameter.to the next page.
if ($Current<>$row_clubset['country_id']) echo '</blockquote> <p>' . $row_clubset['country_id'] . '</P> <blockquote>'.'<a href="viewclubs.php">visit the</a> '. $row_clubset['club_name'] . '<br>' ;
The link should include a parameter and be like this:
<a href="viewclubs.php?pick=<?php echo $row_clubset['club_index']; ?>">Visit the </a>
When I wrap this link around the existing 'Visit the', I get the following line of code:
if ($Current<>$row_clubset['country_id']) echo '</blockquote> <p>' . $row_clubset['country_id'] . '</P> <blockquote>'.'<a href="viewclubs.php?pick=<?php echo $row_clubset['club_index']; ?>">Visit the</a> '. $row_clubset['club_name'] . '<br>' ;
This throws the following error > Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
I think that the probelm is caused by too many or the wrong sort of inverted commas of various sorts but I cannot work it out. Can anyone show me what is wrong?
