I hava a list of data pulled in from a mysql database and displayed using the 'while' statement; which all works great.
When a user clicks on the 'email' link, next to one of the displayed items, a popup form appears, with the idea of emailing/sending the item details to a friend.
Now this all works great, but I can't seem to send the correct items' data to the form when the link is pressed. I'm guessing it could be because it's outside of the php but I don't want multiple instances of the same form being included in the while statement. As it is, there is only one form, I just need to be able to send the items id to it when the email link is pressed.
Any help greatly appreciated, S.
(stripped down code below)
<?php
$query = mysql_query("select * from istable where categoryID = '1'");
while ($result = mysql_fetch_array($query)) {
echo '<h4>'.$result['title'].'</h4>
<p>'.substr($result['descrip'],0,408).'... <a href="'.$wwwUrl.'/p/'.$result['categoryID'].'-'.$result['title'].'.php""><strong>Read more</strong></a></p>
<div class="details">
<a href="#" rel="#sheet" class="see"><img src="'.$wwwUrl.'/images/email-icon.gif" width="23" height="23" alt="Email" /> Email</a>
</div>';
}
?>
<div id="sheet" class="rounded">
<!--{{{ pane1 -->
<div class="pane" id="pane1">
<h4>Email Property Details to a Friend</h4>
<p>You have selected to forward the details of <?php echo $_GET['title']; ?> to a friend.</p>
<p>Please fill out the following form</p>
<form class="rounded" id="email-form" method="post" action="<?php echo $pageLink; ?>">
<!-- form goes in here -->
</form>
</div>
<!--}}}-->
</div>
See Question&Answers more detail:os