0

I have a script that uses a loop (specifically "while") to produce many rows of data based on various rows of data in a SQL database. This script also produces a form within the outputted row. So that it ends up looking like this:

enter image description here

When users click the submit button it processes the data on a new page (ratinghandler.php).

That page will then change the a value in the associated SQL database.

My question is: if each row of output in the original page corresponds to a different row in the SQL database which is referencable by the "id" value of that row. How can I associate the form with the correct "id" variable. Is it possible to tell a form to post data which was not selected by the form operator (i.e. website user)? How can i tell the page ratinghandler.php which row the submitted form corresponded to, if the forms are generated as part of a loop?

I hope I was clear I am happy to answer questions.

1 Answer 1

4

Make the id a hidden field in the form.

<input type="hidden" name="id" value="X" />
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. So my follow up question is how can I make the value a variable. I tried:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.