Page 1 of 1

PHP - passing a variable from a repeated region?

Posted: Thu Apr 12, 2007 11:17 am
by Ender22
Hey, I need a little help here.
I'll try to explain what im trying to do as best as I can.

I have a repeated region with a 'Name' a 'ID' and a 'Submit' button

Repeated Region
------------------------------------------------
{Recordset1.Name}, {Recordset1.ID} | SUBMIT |
------------------------------------------------

so on my page I see every name next to every ID in my database and each one has their own submit button.

Now what I need to do is on Submit pass the specific ID of the row in the table for which the submit button was pressed.

For example if they scroll down to the 5 element in the repeated region (with ID 5) and they hit Submit I need to pass the number 5 to a function.

I understand that you cant call a php function from a button press so I have been trying to do this with the
if(isset($_POST['submit']))
{
// do whatever with the variable.
}

statement.

Does anyone know how I can do this properly?

THANKS!

Posted: Thu Apr 12, 2007 11:41 am
by RobertGonzalez
You could give each button its own name, then loop through the potential names for isset. Although, what I have done is made each row its own form and checked for the submitted user id.

Posted: Thu Apr 12, 2007 12:42 pm
by Ender22
Ahh.. thank you so much!
I went with the second option.
Thanks for the help :D