Here's what I've got (using includePHP plugin to do it in an article, since making a component is beyond my ability and I don't have time to figure it out):
Code: Select all
{php}
$db = JFactory::getDBO();
$user = &JFactory::getUser();
$sqlout = "SELECT * FROM `jos_chronoforms_3` WHERE `username` ='$user->username'";
$db->setQuery($sqlout);
$resultout = mysql_query($sqlout);
while ($myrow = mysql_fetch_assoc($resultout)) {
?>
Name: <?php echo $user->name; ?><br />
Date: <?php echo $myrow['recordtime']; ?><br />
Topic 1: <?php echo $myrow['topic1']; ?><br /><br />
<form name="getreport" action="index.php?option=com_content&view=article&id=47&Itemid=58" method="post">
<input type="textbox" name="recorded" value="<?php echo $myrow['recordtime']; ?>">
<input type="submit" value="Get Report"><br /><br />
<?php
}
?>
{/php}
So, what's supposed to happen is you get a list of all of your submissions, with a "Get Report" button for each one. Clicking the submit button should take you to a page with the full report for that record (by going to another php script in an article that uses the $_POST['recorded'] value to get the record). However, no matter what submit button is clicked, it always brings up the the report for the last record.
I think I probably need some kind of foreach statement so that the value of "recorded" that gets passed is the right one.
I made the input type a textbox just so I could verify it was pulling the right 'recordtime' values for the records (I had it hidden) - and that's fine.
Suggestions?