PHP - Passing db value to a $_POST - value wrong

DiegoM8

New Member
I'm having problems with my code - when I run it, it seem to only pass through the ID information for the last record rather than the one in the row I am trying to list and have a button for. The code for the page is the following (Sorry if there is heaps there - I'm only very new to this):\[code\]<?php require_once('Connections/Demand.php'); ?><?phpif (!function_exists("GetSQLValueString")) {function GetSQLValueString($theValue, $theType, $theDefinedValuehttp://stackoverflow.com/questions/3693961/= "", $theNotDefinedValuehttp://stackoverflow.com/questions/3693961/= "") { if (PHP_VERSION < 6) { $theValue = http://stackoverflow.com/questions/3693961/get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = http://stackoverflow.com/questions/3693961/($theValue !="") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = http://stackoverflow.com/questions/3693961/($theValue !="") ? intval($theValue) : "NULL"; break; case "double": $theValue = http://stackoverflow.com/questions/3693961/($theValue !="") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = http://stackoverflow.com/questions/3693961/($theValue !="") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = http://stackoverflow.com/questions/3693961/($theValue !="") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue;}}$colname_Recordset1 = "-1";if (isset($_COOKIE['DRLogin'])) { $colname_Recordset1 = $_COOKIE['DRLogin'];}mysql_select_db($database_Demand, $Demand);$query_Recordset1 = sprintf("SELECT Title, `Action`, Type, Information, `Date`, Status, ID FROM username WHERE Username = %s AND Active = '1' ORDER BY `Date` ASC", GetSQLValueString($colname_Recordset1, "text"));$Recordset1 = mysql_query($query_Recordset1, $Demand) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);$row=0; $numrows=mysql_num_rows($row_Recordset1);$totalRows_Recordset1 = mysql_num_rows($Recordset1);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Login - Demand & Resolve</title><script type="text/javascript"> function ChangeColor(tableRow, highLight) { if (highLight) { tableRow.style.backgroundColor = '#dcfac9'; } else { tableRow.style.backgroundColor = 'white'; } } function DoNav(theUrl) { document.location.href = http://stackoverflow.com/questions/3693961/theUrl; } </script></head><body><form id="form1" name="form1" method="post" action=""> <p> <input name="hiddenField" type = "hidden" id="GUsername" value="http://stackoverflow.com/questions/3693961/<?php echo $_COOKIE['DRLogin'] ?>" /> To Do List</p> <p>&nbsp;</p></form><table border="1"> <tr> <td>Title</td> <td>Action</td> <td>Type</td> <td>Information</td> <td>Date</td> <td>Status</td> <td>Task ID</td> </tr> <?php do { ?> <tr onmouseover="ChangeColor(this, true); " onmouseout="ChangeColor(this, false);" > <td><?php echo $row_Recordset1['Title']; ?></td> <td><?php echo $row_Recordset1['Action']; ?></td> <td><?php echo $row_Recordset1['Type']; ?></td> <td><?php echo $row_Recordset1['Information']; ?></td> <td><?php echo $row_Recordset1['Date']; ?></td> <td><?php echo $row_Recordset1['Status']; ?></td> <td><form method="post" action="full.php"><input type="hidden" name="pull0" value="http://stackoverflow.com/questions/3693961/<?php echo $row_Recordset1['ID']; ?>"/><input type="submit" name="Action" id="Submit" value="http://stackoverflow.com/questions/3693961/Action" /></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></table></body></html><?phpmysql_free_result($Recordset1);?>\[/code\]On the full.php I am using a $_POST action to pick up the value.
 
Back
Top