Forum Moderators: coopster

Message Too Old, No Replies

Trying to modify a field

update from form

         

YnotInTX

7:34 pm on Apr 3, 2005 (gmt 0)

10+ Year Member



I have a field (item) in a table (todo) and I would like to click on a link (edit.php?id=1) that goes to a page with a form and the field has that information filled into the text box. Clickong the submit button sends the changed field to update.php. I have tried several times to get this done and search here also. If someone could help me with just one field then I will be able to figure out the rest of it. So far everything I try comes up blank. Thank you

coopster

12:24 am on Apr 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Where are you at so far with this, YnotInTX? Have you read the database and populated the form with your data? If not, have you had a chance to look at the Basics of extracting data from MySQL [webmasterworld.com] thread in the PHP Forum Library?

YnotInTX

1:52 am on Apr 13, 2005 (gmt 0)

10+ Year Member



This is what I have put together from a bunch of attempts so it is probably messed up now. I never got it so I set it on the back burner but would love some guidence. Thank you!


<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="select from todo";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

$i=0;
while ($i < $num) {
$item=mysql_result($result,$i,"item");
$description=mysql_result($result,$i,"description");
$category=mysql_result($result,$i,"category");
$priority=mysql_result($result,$i,"priority");

?>
<table width-"80%" bgcolor="c0c0c0"><tr><td>
<form action="updated.php">
<input type="hidden" name="ud_id" value="<? echo "$id";?>">
Item: <input type="text" name="ud_item" value="<? echo "$item";?>"><br>
Description: <input type="text" name="ud_description" value="<? echo "$description"?>"><br>
Category: <input type="text" name="ud_category" value="<? echo "$category"?>"><br>
Priority: <input type="text" name="ud_priority" value="<? echo "$priority"?>"><br>
<input type="Submit" value="Update">
</form>
</td></tr>
</table>
<?
++$i;
}
?>

YnotInTX

2:00 am on Apr 13, 2005 (gmt 0)

10+ Year Member



I should have also said that I can list the items and delete but the edit page comes up blank and the source is blank also. I just haven't learned enough yet to know what is wrong. What I want is a page with a populated form to send info to updated.php to query the database.