I found another article online that was just a simple email feedback form, but it used _REQUEST to pass the variable to the other document, but did not involve posting data to a database. I thought I could get it working that way, but I couldn't get it. I assumed that if my form called the verify.php and then the verify.php called the guestbook_submt.php, I could get the verification...nope, at least not the way I was trying to do it.
Here's the entire page code for the guestbook and the process.
Thanks!
SUBMIT PAGE (guestbook.php)
<html>
<title>A Gruesome Find Guestbook</title>
<link href="../agf.css" rel="stylesheet" media="screen">
<script language="JavaScript" type="text/javascript">
// Javascript validation functions
// http://www.designplace.org/
//function to check empty fields
function isEmpty(strfield1, strfield2, strfield3) {
//change "field1, field2 and field3" to your field names
strfield1 = document.forms[0].comments.value
//comments field
if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
{
alert("\"Comments\" is a mandatory field.\nPlease type something and try again.")
return false;
}
return true;
}
//function that performs all functions, defined in the onsubmit event handler
function check(form){
if (isEmpty(form.field1)){
return true;
}
return false;
}
</script>
<body bgcolor="black" alink="#f46088">
<div align="center">
<a name="top_anchor"></a><img src="/images/agf_fire_logo.jpg" alt="" height="213" width="313" border="0"><br>
<br>
<csobj occur="60" w="909" h="17" t="Component" csref="../../agf_minions_site.data/Components/agf_nav.html">
<div align="center">
<table width="657" border="0" cellspacing="0" cellpadding="0" cool gridx="16" gridy="16" height="17" showgridx showgridy usegridx usegridy>
<tr height="16">
<td cslocked content csheight="16" width="656" height="16" valign="top" xpos="0">
<div align="center">
<font color="white"><a href="../home.html">HOME</a> | <a href="../fire.html">FIRE</a> | <a href="../ravens.html">RAVENS</a> | <a href="news.php">NEWS</a> | <a href="reviews.php">REVIEWS</a> | <a href="interviews.php">INTERVIEWS</a> | <a href="../bios.html">BIOS</a> | <a href="links.php">LINKS</a> | <a href="shows.php">SHOWS</a> | <a href="http://agruesomefind.com/php/guestbook.php">GUESTBOOK</a> | <a href="../contact.html">CONTACT</a></font></div>
</td>
<td width="1" height="16"><spacer type="block" width="1" height="16"></td>
</tr>
<tr height="1" cntrlrow>
<td width="656" height="1"><spacer type="block" width="656" height="1"></td>
<td width="1" height="1"></td>
</tr>
</table>
</div>
</csobj><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">
<hr width="640">
</font><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><br>
</font></div>
<div align="center">
<table width="640" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>
<div align="center">
<p><font size="1" color="yellow" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b><u><i><a href="#entry_form">Sign Guestbook</a></i></u></b></font><font size="5" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b><u><br>
</u></b></font></p>
</div>
<table width="1%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><img src="../flame_top.jpg" alt="" width="640" height="118" border="0"></td>
</tr>
<tr>
<td class="class_white_border_left" valign="top" width="15"><img src="../left_cell_10x1.gif" repeat-y alt="" width="10" height="1" border="0"></td>
<td><?php
mysql_connect ("xxxx", "xxxx", "xxxx");
mysql_select_db (xxxx);
$result = mysql_query ("SELECT * FROM agf_guestbook ORDER BY entry_id DESC
");
if ($row = mysql_fetch_array($result)) {
do {
print '<table border="0" cellspacing="5" cellpadding="0" style="color: #fff;">';
echo "<tr>\n";
echo "<td><b><font color='yellow'>Name: </b><a href='mailto:{$row ["email"]}'target='blank'>{$row ["name"]}</a></font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><b><font color='yellow'>Location: </b></font><i>{$row ["location"]}</i></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><b><font color='yellow'>URL: </b></font><a href='http://{$row ["site_url"]}'target='blank'>{$row ["site_url"]}</a> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><b><font color='yellow'>Comments: </b></font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>{$row ["comments"]} </font></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td><hr width='600'></td>\n";
echo "</tr>\n";
} while($row = mysql_fetch_array($result));
print "</table>";
} else {print "Not working...";}
?></td>
<td class="class_white_border_right" repeat-y>
<div align="right">
<p><img src="../right_cell_10x1.gif" alt="" width="10" height="1" border="0"></p>
</div>
</td>
</tr>
<tr>
<td colspan="3"><img src="../flame_bottom.jpg" alt="" width="640" height="95" border="0"></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="640" border="0" cellspacing="2" cellpadding="0">
<tr>
<td><a name="entry_form"></a>
<form action=http://www.agruesomefind.com/php/guestbook_submit.php method="post" name="theform" onSubmit="return check(this);">
<div align="center">
<table width="95%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="sectionHeaderStyle" colspan="2"><font size="2" color="yellow" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b><u><i>Guestbook Entry Form</i></u></b></font><font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b><u><br>
<br>
</u></b></font></td>
</tr>
<tr>
<td class="tableRowHeaderStyle" colspan="1" width="150">
<div align="left">
<font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Name</b></font></div>
</td>
<td class="tableRowStyle" colspan="1"><input type="text" name="name" size=30 maxlength=80> </td>
</tr>
<tr>
<td class="tableRowHeaderStyle" colspan="1" width="150">
<div align="left">
<font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Email </b></font></div>
</td>
<td class="tableRowStyle" colspan="1"><input type="text" name="email" size=30 maxlength=80> </td>
</tr>
<tr>
<td class="tableRowHeaderStyle" colspan="1" width="150">
<div align="left">
<font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Location </b></font></div>
</td>
<td class="tableRowStyle" colspan="1"><input type="text" name="location" size=30 maxlength=80> </td>
</tr>
<tr>
<td class="tableRowHeaderStyle" colspan="1" width="150">
<div align="left">
<font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>URL (no [url]http://[/url])</b></font></div>
</td>
<td class="tableRowStyle" colspan="1"><input type="text" name="site_url" size=30 maxlength=80></td>
</tr>
<tr>
<td class="tableRowHeaderStyle" colspan="1" valign="top" width="150">
<div align="left">
<font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Comments</b></font></div>
</td>
<td class="tableRowStyle" colspan="1"><textarea name="comments" rows=6 cols=75 wrap="VIRTUAL"></textarea></td>
</tr>
</table>
<font size="2" color="white" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b><br>
<input type=submit name="" value="Sign Guestbook"></b></font></div>
</form>
</td>
</tr>
</table>
<br>
<hr width="640">
<a href="#top_anchor">Back to Top</a></div>
</body>
</html>
PROCESS page (guestbook_submit.php)
<html>
<link href="../agf.css" rel="stylesheet" media="screen">
<head>
<meta http-equiv="refresh" content="0;URL=http://www.agruesomefind.com/php/guestbook.php">
</head>
<body bgcolor="#000011" text="white">
<div align="left">
<?php
mysql_connect ("xxxx", "xxxx", "xxxx");
mysql_select_db (xxxx);
$sql = mysql_query ("INSERT INTO agf_guestbook (name, email, location, site_url, comments)
VALUES ('$name', '$email', '$location', '$site_url', '$comments')
");
print ("Guestbook entry successful");
?><?php mail("ravenwind@agruesomefind.com", "Guestbook Addition", "There is a new guestbook entry! Go check it out! http://www.agruesomefind.com/php/guestbook.php"); ?></div>
</body>
</html>