In the previous chapter, we have seen how to display comments, but this would of course be useless if there wasn't a way for your readers to post their
comments. So we need now to create a "Post a comment" form, which will be included on the "Entry main page" template.
Here is an example of what you could type in the "Comment form" template: |
|
<form action="!!action!!" method="post">
Name: <input type="text" name="name" />
Email: (optional) <input type="text" name="email" />
Website: (optional) <input type="text" name="website" />
Comments <textarea name="combody" cols="39" rows="10"></textarea> <input type="submit" /> </form> |
| |
|
Note that using the above tags won't allow the form to remember the visitor's information, so they will have to type in their name
and email every time they want to post a new comment. While you can leave the form like that if you wish, it would be nice to make the form remember
the visitor's in formation by inserting the following code inside the name tag: value="!!authname!!",
by inserting the following code inside the email tag: value="!!authemail!!",
and inserting the following code inside the website tag: value="!!authwebsite!!".
So the name, email and website tags would look like this:
<input type="text" name="name" value="!!authname!!" />
<input type="text" name="email" value="!!authemail!!" />
<input type="text" name="website" value="!!authwebsite!!" />
You will also need to add a "Remember me" html checkbox, which is displayed using the following code:
<input type="checkbox" name="remember" !!ischecked!! /> Remember my info
The complete form code would then be: |
|
<form action="!!action!!" method="post">
Name:<br /> <input type="textfield" name="name" value="!!authname!!"><br />
Email: (optional)<br /> <input type="textfield" name="email" value="!!authemail!!"><br />
Website: (optional)<br /> <input type="textfield" name="website" value="!!authwebsite!!"><br />
Comments<br /> <textarea name="combody" cols="39" rows="10"></textarea><br />
<input type="checkbox" name="remember" !!ischecked!! /> Remember my info!<br />
<input type="submit" />
</form> |
| |
|
| This is what our form looks like: |
|
|
Important note:
The <form action="!!action!!" method="post">
line, the <input type="text" name="name" />
line, and the <textarea name="combody"></textarea> line
must be placed on the form template for the form to work properly.
To insert this form into the "Entry main page", simply add the !!comform!! variable: |
|
<html>
<head> <title>My Upsaid web log - Entry page</title> </head>
<body>
<table width="400" bgcolor="#D0F0EB"> <tr><td><u>!!title!!</u></td></tr> <tr><td>!!body!!</td></tr> <tr><td align="right">Posted at !!hours12!!:!!minutes!! !!ampm!!</td></tr> </table>
<table> !!dispcom!! </table>
!!comform!!
</body>
</html> |
| |
|
| Our "Entry" page will then look something like this: |
|
|