thefollower Posted November 6, 2007 Share Posted November 6, 2007 I have a form which has a while loop inside to echo a table. But not only that i have a submit button and a check box which I want to have the value of the row's ID so that if the submit button is pressed it will delete the adjacent row.. but just curious if this following idea is going to work : Form: <form name="" method="POST" action="deletemessages.php" id="Form1" onsubmit="return ValidateForm1(this)"> <? $Total = 0; $Distance = 60; while($row = mysql_fetch_array($GetLetters)) { $Total = $Total + 1; $Distance = $Distance + 60; $Subject = $row['Subject']; $From = $row['Sender']; $SentOn = $row['SentTime']; $Message = $row['MessageText']; $MessageID = $row['CallID']; $FindUser = mysql_query("SELECT * FROM userregistration WHERE UserID='$From'") or die(mysql_error()); //Fetch the row from the database if (mysql_num_rows($FindUser)) { $rowuser = mysql_fetch_assoc($FindUser); $UserName = $rowuser['Username']; $StaffMember = $rowuser['StaffDuties']; } If ($StaffMember == ''){ $Staff = ''; } Else{ $Staff = 'STAFF MEMBER'; } echo '<tr> <td width="200"><center><font style="font-size:14px" color="#FFFFFF" face="Arial">From: <font color="#32CD32">'; Echo $UserName; Echo'</font></br><font color="#EE9A4D">'; Echo $Staff; Echo'</font>'; Echo'</br><font color="#FFFFFF">Sent On: </font><font color="#32CD32">'; Echo $SentOn; Echo'</font></br></center></font></td> <td width="200"><center><font style="font-size:14px" color="#FFFFFF" face="Arial">Subject: </font></br><font color="#32CD32">'; Echo $Subject; Echo'</br><hr size="2" width="40" id="Line2" style="width:200px;height:2px;z-index:0">'; Echo'</font>'; Echo'<font color="#FFFFFF">Message: </font><font color="#32CD32"></br><b>'; Echo $Message; Echo'</font></b></center></font></td>'; Echo' <td background="menu_gradient.gif" bgcolor="#FFFFFF" style="background-repeat: repeat-x;"><center><font style="font-size:14px" color="#FFFFFF" face="Arial">'; Echo'<a href="reportmessage.php?report=';Echo$MessageID;Echo'">Report</a></br></br>'; Echo'<input type="checkbox" id="Checkbox1" name="';Echo$MessageID;Echo'" value=""> <input type="submit" id="Button1" name="';Echo$MessageID;Echo'" value="Delete">'; Echo'</center></td></tr>'; } echo '</br></br></table></br></div>'; ?> </form> Then i was going to put in the deletemessages.php from the forms action option to do a $_POST['ButtonName']; But i am not sure what i should put in the ['ButtonName'] part in bold... cos $MessageID isnt a session and it can be if its a while loop cos itll only every be the last row that is assigned to the session... so how can i get the submit (and the checkbox) to be related to each row correct and then in the form obtain the correct row value which in this situation is ID. Link to comment https://forums.phpfreaks.com/topic/76241-form-obtaining-values-for-process/ Share on other sites More sharing options...
thefollower Posted November 6, 2007 Author Share Posted November 6, 2007 any one ??? Link to comment https://forums.phpfreaks.com/topic/76241-form-obtaining-values-for-process/#findComment-385999 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.