I'm am extracting (using php) some text entries from an Oracle 10g DataBase. The problem is that I also need to add a comment form to every text entry so that users can respond to the original text ( it's like stackoverflow really: the original texts are the questions and attached to every questions there's a form for answering ). When I insert a specific comment/answer in the database I have to also attach the question ID so that I know which comment belongs to which question. How do I do that ? I've tried a hidden input that holds the value of the qID, but that value always ends up being the last qID extracted.
This is hard to answer without seeing the code, but I'm guessing that you'll have to put your hidden tag/form at a point within the page where the Question associated with that form is being displayed, before the next question is processed.
So if you've 15 questions displayed on a page, each one is going to have the text produced from a rowset that will include the question ID, subject, text, and whatever else. While that row is current in your loop, print the comment form at that stage, with the active qID.
If anyone wants to know what the problem was: Each time I displayed a new question ( extracted from the database ) I also declared a form with 3 simple fields: Name ( of the person who wants to answer ), Answer and a hidden tag that took the value of the current question's ID. If one chose to send the answer, his name, message and the question ID would be inserted in the Answers table of the DB. My problem was that the hidden value always equaled the qID of the last displayed question. Solution: I forgot to add the closing form tag: . There actually wasn't a single answering form for every question, but a single general form that only answered the last question.
I hope i've been clear enough about this. Thanks for the help !