Hi There,
I was wondering if someone could give me some advice on how to build a form so I can edit a submission to my database -
At the moment I have the script in place to submit items to the database (Below)
PHP Code:
<? include("auto_disable.inc"); ?>
<html>
<head>
<title>Submit Book & Movie Details</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>A:link{text-decoration:none} A:link:visited{text-decoration:none} A:link:hover{color:white;text-decoration:underline} </style>
</head>
<body bgcolor="#C0C0C0" text="#FFFFFF" link="#FF9900">
<?
if ($submit)
{
if (!$newsname)
{
echo "Please put in a name for your news article.<br>\n";
?>
<?
} else {
if (!$newsby)
{
echo "Please enter a username for you to be known by.<br><br>\n";
?>
<?
} else {
if (!$newsbody)
{
echo "Please enter your news.<br><br>\n";
?>
<?
} else {
$newsbody=ereg_replace("\n","<br>",$newsbody);
$date=date("l F d, @h:iA");
$newsname=addslashes($newsname);
$newsby=addslashes($newsby);
$newsbody=addslashes($newsbody);
$sql="INSERT INTO book1 (newsname,newsby,newsbody,newsat) VALUES ('$newsname','$newsby','$newsbody','$date')";
$result=mysql_query($sql);
$sql="SELECT * FROM book1 ORDER by newsid DESC LIMIT 0,1";
$result=mysql_query($sql);
while ($myrow=mysql_fetch_array($result))
{
$last_newsid=$myrow["newsid"];
}
$sql="INSERT INTO `forum_topic` (`boardid` , `topic_name` , `topic_by` , `topic_body` , `topic_date` , `topic_type` , `lastpost` , `topic_special_id` , `special_id_type`) VALUES ( '9', '$newsname', 'Admin', '$newsbody', '$date', '0', '0','$last_newsid','3')";
$result=mysql_query($sql);
echo "Thanks for your submission, It has now been recorded. If there are problems with this please contact Andy Pugh\n";
}}}}
else {
?>
<form method=post action=book1.php>
<p><font face="Verdana"><b>Article Headline:<Br>
<input type=text name=newsname size="30">
<br>
</b></font></p>
<p><font face="Verdana"><b>Your Name:
<Br><input type=text name=newsby size="20">
<br>
</b></font>
</p>
<p><font face="Verdana"><b>Your News:<Br><textarea rows=12 cols=42 wrap=virtual name=newsbody></textarea>
<br>
<br>
<input type=submit name=submit value="Submit this Article"> </b></font> </p>
</form>
<?
}
?>
I use auto_disable.inc for the database connection, so authorization is not neccessary -
Basically what I would like is the ability to click on an already posted article to 'book1' for example and have it in a box which I could then edit and resubmit..
If this is quite complex I would be willing to pay for your time.
Andy