pastorandy
IS-IT--Management
I have a newsletter which has about 20 dynamic pieces of content that come from a mySql database. One of the fields in my newsletter table is called test_field.
I am just creating this application at the moment but have got to the stage where I want to be able to edit each part of the newsletter.
What I am trying to do is click on a link or a button - next to the content that I want to edit within the newsletter but I want to be able to use one form page to edit and then update that content.
I don't want to bring all the content of the newsletter into my edit form - just the piece that I want to edit.
My first thought was to do something like this in the newsletter:
This would send me to my edit page and pass the newsletter table field (test_field) that I want to use in my edit form.
Then on my editNews.php page I would have something like this:
and then within my form I would have the field that I want to update...
However, the $row[form_field] doesn't display the content of that particular table field which is the value of test_field.
I am possibly doing this completely wrong but has anyone got any ideas on how I would achieve this?
I am just creating this application at the moment but have got to the stage where I want to be able to edit each part of the newsletter.
What I am trying to do is click on a link or a button - next to the content that I want to edit within the newsletter but I want to be able to use one form page to edit and then update that content.
I don't want to bring all the content of the newsletter into my edit form - just the piece that I want to edit.
My first thought was to do something like this in the newsletter:
Code:
<a href='editNews.php?newsletter_id=$row[newsletter_id]&form_field=test_field'><img src='./img/edit.gif' border='0'></a>";
This would send me to my edit page and pass the newsletter table field (test_field) that I want to use in my edit form.
Then on my editNews.php page I would have something like this:
Code:
$form_field = $_GET['form_field'];
$query2 = "SELECT * from newsletter WHERE newsletter_id = $newsletter_id
";
$result2 = mysql_query($query2) or die (mysql_error());
while($row = mysql_fetch_array($result2))
{
?>
and then within my form I would have the field that I want to update...
Code:
<TR><TD>Comments:</TD><TD><textarea cols='70' rows='10' name='<?=$_GET[form_field]?>'><?=$row[form_field]?></textarea></TD></TR>
However, the $row[form_field] doesn't display the content of that particular table field which is the value of test_field.
I am possibly doing this completely wrong but has anyone got any ideas on how I would achieve this?