cshaw Posted March 30, 2010 Share Posted March 30, 2010 Hello, I am having trouble with submitting a row from a repeat region. Each row of the repeat region contains 'ID' and a 'Submit' checkbox. Repeated Region ------------------------------------------------ {Recordset1.ID}-hidden, {Recordset1.notes} | SUBMIT | ------------------------------------------------ On my page I see a list of notes and each one has it's own submit checkbox that should be removed when done(checked off). My problem it that it does not matter what checkbox is selected, it only removes the last entry in the list (submits the last row's ID). Now what I need to do is on Submit pass the specific ID of the row in the table for which the submit was triggered. 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. Does anyone know how I can do this properly? Any help would be appreciated! Link to comment https://forums.phpfreaks.com/topic/197021-php-passing-a-variable-from-a-repeated-region/ Share on other sites More sharing options...
cshaw Posted March 30, 2010 Author Share Posted March 30, 2010 Here is the code for the form. <form action="<?php echo $editFormAction; ?>" id="form2" name="form2" method="POST"> <p> </p> <table> <tr class="tRow"> <td>Repaired:</td> <td>Foreman Notes:</td> </tr> <?php do { ?> <tr> <td><input name="equ_hr_id" type="hidden" id="equ_hr_id" value="<?php echo $row_rsForemanNotes['equ_hr_id']; ?>" /><?php echo $row_rsForemanNotes['equ_hr_id']; ?> <input name="notes_closed" type="checkbox" id="notes_closed" value="" onmouseup="form2.submit()" /></td> <td><?php echo $row_rsForemanNotes['notes']; ?></td> </tr> <?php } while ($row_rsForemanNotes = mysql_fetch_assoc($rsForemanNotes));?> </table> <input type="hidden" name="MM_update" value="form2" /> </form> Here is the php code. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) { $updateSQL = sprintf("UPDATE equ_hours SET notes_closed=%s WHERE equ_hr_id=%s", GetSQLValueString(isset($_POST['notes_closed']) ? "true" : "", "defined","1","1"), GetSQLValueString($_POST['equ_hr_id'], "int")); mysql_select_db($database_earth_iron, $earth_iron); $Result1 = mysql_query($updateSQL, $earth_iron) or die(mysql_error()); } The problem is with the line: GetSQLValueString($_POST['equ_hr_id'], "int")); this returns the current 'equ_hr_id' for the FORM. I want it to submit the $row_rsForemanNotes['equ_hr_id'] when the checkbox for it's row is checked. The page then refreshes without the checked note. Thanks Link to comment https://forums.phpfreaks.com/topic/197021-php-passing-a-variable-from-a-repeated-region/#findComment-1034299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.