Copy link to clipboard
Copied
Sorry this is a bit long winded.
I have a single MySQL table holding Volunteer's information and their assigned activity and am able to display a list of Volunteer's names and link from the Volunteer's name to an information page which displays all the Volunteer's info using an index called "volunteernumber" and passed as a URL parameter. This is working fine. I also have a web page that shows a list of Volunteers names categorized by their assigned activity - and this works fine.
It will help my users to be able to combine the functionality so they can use the categorized list of Volunteer names and click on the volunteer's name to go to a page displaying the volunteer's information. Sorry I can't give you a link to the page as it contain personal contact info. The problem I'm having is that the parameter "volunteernumber" is not being added to the url generated by the <a href=....... code.
Below is the code that displays the categorized list of Volunteers names without a link - this code works correctly.
<?php
// initialize a variable to store the previous activity
$previous = ' ';
do {
if ($row_rsVolunteersFriday['assignedactivity'] != $previous)
echo "<b>".$row_rsVolunteersFriday['assignedactivity']."</b><br>";
echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
// store the current name in the $previous variable
$previous = $row_rsVolunteersFriday['assignedactivity'];
} else
{ echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
}
?>
<?php } while ($row_rsVolunteersFriday = mysql_fetch_assoc($rsVolunteersFriday)); ?>
Here is the code that fails to add volunteernumber to the URL parameter, it generates a link containing www.hollisterairshow.com/admin/"showvolunteer.php?volunteernumber= NOTE it generates a spurious quote in the middle of the URL and does not append the parameter 'volunteernumber'.
Note for test purposes I only altered the code that displays the hyperlink when the categorized activity has not changed i.e. the code that occurs after the "else". I have bolded this code below
<?php
// initialize a variable to store the previous activity
$previous = ' ';
do {
if ($row_rsVolunteersFriday['assignedactivity'] != $previous)
{ echo "<b>".$row_rsVolunteersFriday['assignedactivity']."</b><br>";
echo $row_rsVolunteersFriday['firstname']." ";
echo $row_rsVolunteersFriday['lastname']."<br>";
// store the current name in the $previous variable
$previous = $row_rsVolunteersFriday['assignedactivity'];
} else
{
?>
<a href = ”showvolunteer.php?volunteernumber=
<?php echo $row_rsVolunteersFriday['volunteernumber']; ?>&tab=3" title="Show Volunteer Information">
<?php echo $row_rsVolunteersFriday['firstname']." ".$row_rsVolunteersFriday['lastname']; ?></a><br />
<?php
}
?>
<?php } while ($row_rsVolunteersFriday = mysql_fetch_assoc($rsVolunteersFriday));
?>
I'm using DW CS4 with PHP and MySQL.
Thanks for any assistance, I've been staring at this for hours and can't see what I did wrong.
Tony
Copy link to clipboard
Copied
Never mind !! I found it and fixed it.
In case anyone else has this problem it turned out that when I copy/pasted some code I stupidly did some editing
in MS Word then copy/pasted from Word to DW Code view. This inserted an extraneous
new line and converted the leading quote into something that looked like a quote and wasn't.....sigh
.