...

View Full Version : Guestbook Help!!



bhaveshandshrey
01-16-2008, 08:43 PM
I am trying to create a guestbook where people submit their NAME, EMAIL, and COMMENTS. Upon submit, their comment, name, and the current date are posted in a section underneath the form. When the next person comes to the site, they can see the previous posted message and if they input their own comments, upon submit, their comments with name and date will be posted above the previous comment.

What I have thus far is the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Guestbook</title>

<script type="text/javascript">
function submitForm() {
name = document.theform.username;
email = document.theform.useremail;
comm = document.theform.comment;

html = "<p>";
html += name + "<br>";
html += comm + "<br>";
html += (new Date()) + "<br>";
html += "</p>";

alt = document.getElementById("comm").innerHTML;

document.getElementById("comm").innerHTML = html + alt;

return;
}
</script>

<FORM id="theform" METHOD="POST" ACTION="Guestbook.htm" onsubmit="return submitForm();">

<B>Name:</B>
<INPUT NAME="username" size="30"> <BR>

<B>E-mail Address:
</B>
<INPUT Name="usermail" size="30">
<h4>Make any comments you'd like below:</h4>
<LEFT>
<h5>
<TEXTAREA NAME="comment" ROWS=6 COLS=60></TEXTAREA>
</h5>
<P>
<INPUT TYPE=submit VALUE="Send it!">
<INPUT TYPE=reset VALUE="Reset">
</CENTER>
</FORM>


<p>&nbsp;</p>
<p>&nbsp;</p>

<div id="comm"></div>

</body>

</html>

I thought this would work but it is not. I am not very fluent in HTML and did most of this by searching the internet. If anyone can help me get this to work, I would really appreciate it

Thank you

VIPStephan
01-16-2008, 09:54 PM
You can’t submit form data without it being processed by a server-side script (such as PHP, ASP, Ruby on Rails, etc.). JavaScript can do some enhancements but where do you store the data that is submitted (i.e. the guestbook entries)?
You could store the data in a text/XML file but you’d still need more than JS to process it.

bhaveshandshrey
01-16-2008, 10:02 PM
Could you help me with coding it so that I could get it to work? I registered through GoDaddy and hosting is also through GoDaddy

rmedek
01-16-2008, 10:30 PM
Please don't crosspost. It's against the forum rules.

http://www.codingforums.com/rules.htm
http://www.codingforums.com/showthread.php?t=131399



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum