I know the title is a bit confusing but I wasn't exactly sure how to describe my issue and none of my numerous searches online and here returned any positive results..
What I'm trying to do is allow a user to 'choose' one set from multiple sets of numbers for inclusion into the database. The image below should with the visualization of my goal.
As you can see from the above image, there's a "button" to the right that states "keep this set". My goal is to allow the user to click the button and the corresponding set of values is then entered into the database as a string (the values aren't being used in any calculations afterwards just being displayed on screen.)
The following code below works for auto-insertion if there's only one set generated but nothing I've attempted so far works when it comes to allowing the user to choose one set they'd like entered.
<?php
additional code here...
echo '<table><tr><td>';
for($i=1; $i<=$Sets; $i++){
$Stat_Results = GenStats($SpecId, $min, $Quantity, $Type);
echo "Stat values for ".$SetGenerated[$i];
foreach($Stat_Results as $key => $DisplayStats){
echo $DisplayStats.', ';
}
if($Sets == 1){
$SetResults = implode(',',$Stat_Results);
DB_Insert($UserId, $SetResults, $TimeStamp);
}else if($Sets >= 2){
echo "</td><td> => <input type='button' name='submit' value='keep this set'></td>
<tr><td>";
}
}
echo '</td></tr></table>';
?>
html below here....
I've tried Javascript but too be honest, I'm not all that familiar with it (though I am trying to become more fluid in it) and I've went so far as to try to create the multiple sets as a dropdown box thinking the user could simply select it from there and it be treated as a dynamic form and php would do the rest. But that didn't work either. The form button for submission is the remnant of the list I tried to generate. The form is no longer there. I left it in there to generate the image you see above and has since been removed from the actual code.
I admit, I'm stuck and need some guidance because I can't seem to make this work no matter what I do.
Thanks to all who read and attempt to help!
P.S: I apologize in advance for the title and for the sloppy code. I tried to format it but was having difficulty getting it to look right using the WYSIWYG editor on this site.