My friend, you have an awesome ability to explain something and leave me more confused.
I have to ask .... what is it that you are actually trying to make. Somehow I feel like this may be one of the weirdest things of all time. You have a secret question / answer combo stored in a database, but you also have a series of guesses. The guesses are displayed, and you want to what? Let the users modify the guesses? For what purpose? Do you realize that they will be able to fake a 'perfect match' really easily? And then what? Guesses are stored back to the database ... or are they always the same?
It seems illogical to create what looks like a 'mastermind' style system that doesn't enforce any rules other than all characters from the master code must exist in the guess. You have 7 digit codes, so assuming that you enforce guesses to also be 7 characters, then there would be thousands of combinations that would *appear* a perfect match with a score of 7 matches. Maybe hundreds of thousands. I'd work it out but I'm crap at maths.
Anyhow, it would appear from you sample numbers in your last post that you are passing multiple guesses which are the same. Because you are using the guess as the key in the $_POST array, a duplicate will overwrite the previous one. When creating an array, $_POST or otherwise, you must ensure that your keys are unique.
Assuming this is in fact your problem .... the following should work.
Code: Select all
foreach($matches as $id=>$match) $result_details.="<tr><td>$match</td> <td><input type='text' name='matchnumber[$match|$id]' /></td></tr>";
How'd I do?