1. Create a new document, save it as blog.php.
2. Open the document in code view
3.Copy and paste the code below between the body tags.
4. Replace the word 'david' with your login name.
5. Open the document that has your form on it (comment.php) and locate the form tag in code view
<form id="form1" name="form1" method="post" action="">)
6. Replace action="" with action="blog.php". The form tag should look like:
<form id="form1" name="form1" method="post" action="blog.php">
7. Upload and give it a try. If it works, you should be taken to a page that says "Thanks for your comment"
We still have another step to do before the comments will appear on your page.
-------------------------------------------------
<?php
$when = date("F j, Y, g:i a");
$conn = mysql_connect("localhost", "wetsoxor_student", "coyote");
mysql_select_db("wetsoxor_davinci", $conn) or die(mysql_error());
if(stristr($_POST[comment], 'http://' ) or stristr($_POST[name],'http://') )
{
Print "Postings may not include URLs <br />";
} else {
$sql="insert into blog values ('david', '$when', '$_POST[comment]', '$_POST[name]', '')";
$result=mysql_query($sql, $conn) or die(mysql_error());
print "Thanks for your comment $_POST[name]";
}
?>