What I'm doing on this said page is making it so there is an easy to edit box (or other input types) for the user to edit the information on an item in the system, but it's coming back with not the whole field.
Here is what I'm using, as an example, (edited out info of course)
Code: Select all
<? include 'functions.php';
mysql(1); //custom fucntion just to connect to mysql data base
$result = mysql_query("SELECT * FROM `items` WHERE `id` = ".$_POST['id']."");
while($row = mysql_fetch_array($result, MYSQL_BOTH)){
echo "<table border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\">
<tr>
<td><form name=\"form1\" method=\"post\" action=\"items_edit_ac.php\">
<table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"0\">
<tr>
<td colspan=\"3\"><strong><div align=\"center\">Edit An Item</div></strong></td>
</tr>";
echo "<tr>
<td width=\"71\">Edit Item</td>
<td width=\"6\">:</td>
<td width=\"301\"><input name=\"item\" type=\"text\" value=\"".$row['itemname']."\" ></td>
</tr>";
echo "<input type=\"hidden\" name=\"id\" id=\"id\" value=\"".$row['id']."\">
<tr>
<td colspan=\"3\" align=\"center\"><input type=\"submit\" name=\"Submit\" value=\"Submit\"><input type=\"reset\"><br />Make sure everything is correct before hitting submit</td>
</tr>
</table>
</form>
</td>
</tr>
</table>";
} //end while
?>Code: Select all
Apple: Really I have no idea what I'm doing wrong. Thoughts?
EDIT: forgot the part in the code that would show the pulling of info into the input field. >_< needs more coffee.
EDIT2: The database table for this field is a varchar(200) and latin1_swedish_ci for the collation.
EDIT3: Playing around with the code some more, is giving me the same result if I set a variable outside the table to something like $item. But if I call the variable outside the table it seems to work fine with the full result but not in the input field.