Skip to main content
Participant
June 8, 2008
Question

Updating dynamic data

  • June 8, 2008
  • 2 replies
  • 279 views
Hello there,

I'm following a tutorial that shows how to create an update/edit form to edit selected records within the database. However, it is not working. I don't know what I'm missing.

This is the form containing the records I want to update.
Everything is set right, artistid and even the hidden field is placed correctly. but when I'm on the masterdetails page and click on EDIT, it takes me to the edit page but it's all empty.

What am I missing?
This topic has been closed for replies.

2 replies

SlevinkAuthor
Participant
June 8, 2008
I think I did exactly what you said and it's still not working :S

This is the table from artistsmaster.php, it has an edit hyperlink that links to the edit page.

[code]
<table border="1" align="center">
<tr>
<td>ARTISTID</td>
<td>FIRSTNAME</td>
<td>LASTNAME</td>
<td> </td>
</tr>
<?php do { ?>
<tr>
<td><a href="artistdetail.php?recordID=<?php echo $row_rsArtist['ARTISTID']; ?>"><?php echo $row_rsArtist['ARTISTID']; ?> </a></td>
<td><?php echo $row_rsArtist['FIRSTNAME']; ?> </td>
<td><?php echo $row_rsArtist['LASTNAME']; ?> </td>
<td><a href="editartist.php?artistid=<?php echo $row_rsArtist['ARTISTID']; ?>">Edit</a></td>
</tr>
<?php } while ($row_rsArtist = mysql_fetch_assoc($rsArtist)); ?>
</table>
[/code]

And this is a screenshot of editartist.php just to show you that I have done everything correctly.

http://www.imagebase.ws/images/b9lybqg4nllxc23uxag9.gif
Inspiring
June 8, 2008
Editing fields in a database requires that you tell the database what row
(record) and field you want to change.

Create a master data page that shows all of the rows in a table, each row
(record) is identified by a unique id (number), you must pass the ID of the
record you wish to edit to the edit record page. The edit button hyperlink
includes that data The edit record page recordset filters the table data by
the ID (filter record by URL parameter = ID) selecting the correct record to
be edited.

Jeff


"Slevink" <webforumsuser@macromedia.com> wrote in message
news:g2ggm1$t95$1@forums.macromedia.com...
> Hello there,
>
> I'm following a tutorial that shows how to create an update/edit form to
> edit
> selected records within the database. However, it is not working. I don't
> know
> what I'm missing.
>
> This is the form containing the records I want to update.
> Everything is set right, artistid and even the hidden field is placed
> correctly. but when I'm on the masterdetails page and click on EDIT, it
> takes
> me to the edit page but it's all empty.
>
> What am I missing?
>
>
> <form id="form1" name="form1" method="POST">
> <table width="400" border="0">
> <tr>
> <td>Firstname</td>
> <td><label>
> <input name="firstname" type="text" id="firstname"
> value="<?php echo $row_rsArtist['FIRSTNAME']; ?>" />
> </label></td>
> </tr>
> <tr>
> <td>Lastname</td>
> <td><label>
> <input name="lastname" type="text" id="lastname"
> value="<?php echo $row_rsArtist['LASTNAME']; ?>" />
> </label></td>
> </tr>
> <tr>
> <td>Email</td>
> <td><label>
> <input name="email" type="text" id="email"
> value="<?php
> echo $row_rsArtist['EMAIL']; ?>" />
> </label></td>
> </tr>
> <tr>
> <td><input name="artistid" type="hidden" id="artistid"
> value="<?php echo $row_rsArtist['ARTISTID']; ?>" /></td>
> <td><label>
> <input type="submit" name="SUBMIT" id="SUBMIT"
> value="Submit" />
> </label></td>
> </tr>
> </table>
> </form>
>