Log in

View Full Version : How to post comments to a php page



Benedizione
02-08-2008, 10:46 PM
On the same page that I recently password protected, I now would like to allow the person viewing the page to be able to "POST" comments to the page. How can I do that?

I found a blogging program in php but after seeing it set up, I really don't think it is what I need because I am not trying to accommodate any number of people to register a username and password in order to blog.

I only want to accommodate one person, who already typed in a password to enter the page, to be able to post comments to that page.

Is this possible?

Dre

Removed formatting. We're not blind.

Nile
02-08-2008, 10:51 PM
Can it be using MySQL?

thetestingsite
02-08-2008, 10:52 PM
It is possible, but depending on the set up you have now, it could be very easy or slightly more difficult to work on your page. You can look at the documentation for fopen (http://php.net/fopen), fwrite (http://php.net/fwrite), file_get_contents (http://php.net/file_get_contents), and other file system commands; or look at http://www.php-mysql-tutorial.com for tutorials on using php and mysql for this.

Hope this helps.

Benedizione
02-08-2008, 10:58 PM
Yes, mysql is good.

My website server is with godaddy. I only learned yesterday about how to setup a database in mysql so I have done that and then do not know where to go from there.

Dre

Nile
02-08-2008, 11:00 PM
Well, I think you can learn MySQL, its really fun! Try it(if you don't KNOW php)

Benedizione
02-09-2008, 12:29 AM
This is the program that I ended up using to password protect my page http://www.zubrag.com/scripts/password-protect.php I had to tweak it to get it the way I wanted it because again, I am not wanting multiple users but so far it is working out very well.

I don't know if that is any indication about how difficult or simple it might be to set up the "post" function I want to do. But, so far, looking over all this database thing is very complicated for me.

Dre

jackbenimble4
02-09-2008, 03:28 AM
There are quite a few ways to do this, but if you're new to PHP most of them probably will be confusing at first. MySQL databases are very common in PHP applications, so learning that approach would likely be the most beneficial later on. Here's another tutorial if you're interested: PHP MySQL Introduction (http://www.w3schools.com/php/php_mysql_intro.asp)

Depending on your installation, storing the comments in a XML file might be a possibility. If you have PHP 5 and the SimpleXML extension (http://us2.php.net/simplexml) installed, this is a fairly 'simple' solution. Otherwise, manipulating an XML file may be out of your league right now.

Another option is to simply store the comments in a text file separating comments however you choose and reading them from the text file. This alternative was already mentioned by thetestingsite. The functions he referenced, fopen (http://us3.php.net/manual/en/function.fopen.php), file_get_contents (http://us3.php.net/file_get_contents), fwrite (http://us3.php.net/manual/en/function.fwrite.php) can be used to manipulate a file.

Benedizione
02-09-2008, 03:35 AM
What does the big red circle with "Edit: Removed formatting. We're not blind" mean? I have not seen that before and I don't get it. Did I do something wrong?

Dre

TimFA
02-09-2008, 05:09 AM
I believe it means tech_support removed whatever formatting you had, and told you we were not blind. :) You probably used lots of bolding/coloring, don't worry about it. I can't help you with your thing, MySQL stumps me...

Tim

Benedizione
02-09-2008, 08:55 AM
Well, guys, I am stumped on all this scripting too. I have been working with all kinds of stuff for hours and have not established anything. *grins*

I did find this example: http://www.instantsitecomments.com/test.html that I like the way it works and it would be great to do this...just a simple task it seems.

It's not php but isn't there some kind of simple code I could establish to create the same thing? Something that is much less complicated than databases and code I do not understand?

:confused:

Dre

jackbenimble4
02-09-2008, 02:18 PM
Well, guys, I am stumped on all this scripting too. I have been working with all kinds of stuff for hours and have not established anything. *grins*

I did find this example: http://www.instantsitecomments.com/test.html that I like the way it works and it would be great to do this...just a simple task it seems.

It's not php but isn't there some kind of simple code I could establish to create the same thing? Something that is much less complicated than databases and code I do not understand?

:confused:

Dre

More than likely, the code behind that example you would find confusing. The only thing I can recommend is taking your time. New concepts can't be instantly absorbed by our brains. If you be persistent and take a tutorial step by step, completing every exercise highlighted, you will understand it in time. It will also be a stepping stone allowing you to move on to more complicated programming techniques and concepts.

Benedizione
02-09-2008, 06:11 PM
Is it possible to tweak a simple mail program to "post" to a page instead of sending in an email?

http://www.dynamicdrive.com/style/csslibrary/item/css-tableless-form/P50/

Dre

thetestingsite
02-09-2008, 06:24 PM
You could, but either way you would want to reference what was already mentioned on how to do it. http://www.php-mysql-tutorial.com/ is a good place to start for using php to post and retrieve info to/from a MySQL database. The following pages should be looked at for some sample code on how to do both of these. The other option is to avoid a database and simply post to text files using the commands I referenced earlier in this thread.

http://www.php-mysql-tutorial.com/mysql-insert-php.php
http://www.php-mysql-tutorial.com/php-mysql-select.php


Hope this helps.


Also, the link that you posted above is just a form and there is no server side action to it.

Benedizione
02-09-2008, 08:16 PM
It would certainly be better to avoid the database since it is even more difficult for me. How many pages of php would I need to accomplish this task in just php?

Is this right............I create a php page with php coding which is going to "echo" off of another .txt page which contains the actual html coding of the design and content of the page?

Am I close to what I need to do? Or am I still way off base?

That seems to be the way it worked for my menu and to password protect the page but I have been looking over the php material you all showed me and I am still confused about how to coordinate the coding. I keep goofing around with it to see what it does but would like to know if I am even on the right track or not.

Dre

jackbenimble4
02-10-2008, 05:27 PM
At this point, you would probably want to hard code the html into the php. Here's a little example. This would all be one file.:



<html>
<head>
<title>Comments</title>
</head>
<body>
<h1>Comments</h1>
<?php

// read comments from the database, a text file, a xml file, whatever

// loop through comments, and for each one:
echo "<p>".$comment['text']."</p>";


?>
</body>
</html>


Here's an example using a mysql database:



<html>
<head>
<title>Comments</title>
</head>
<body>
<h1>Comments</h1>
<?php

$conn = mysql_connect("localhost","user","password");
mysql_select_db("database_name",$conn);

// get all the rows from the table named 'comments' in the database 'database_name'
$getCommentsQuery = mysql_query("SELECT * FROM comments");

// this loops through the results from the query
while($row = mysql_fetch_array($getCommentsQuery)) {
// $row will be an associative array of data for a row during each iteration

// print the data that's in the column 'text'
echo "<p>".$row['text']."</p>";
}

?>
</body>
</html>

I hope that helped you. By the way, reading and writing to a text file isn't all that easy for a beginner. I'd recommend you stick with a database if your host supports it. It's more commonly used, and it's arguably the most simple way to do this.

Benedizione
02-10-2008, 06:18 PM
Thank you, Jack! I will play around with this and see how it goes.

I have a big medical terminology exam tomorrow so I may have to wait until after my exam to get back to my coding.

Dre

Master_script_maker
02-10-2008, 07:17 PM
here is a script that uses a text file named comments.txt:
an example form:

<form action="submit.php" method="post">
Name: <input type="text" name="name"><br>
Comment:<br>
<textarea name="comments"></textarea>
<input type="submit" name="submit" value="Send">
</form>
submit.php (comments.txt must already be created):

<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'];
fwrite($file,$contents);
fclose($file);
}
?>
read.php:

<?php
$format=Array(
'<table width="100%" align="center" border="0">\n',
'<tr>\n<td><b>',//beginning tags for the name
'</b></td>\n',//ending tags for the name
'<td>',//beginning tags for the comment
'</td></tr>',//ending tags for the comment
'</table>'
);
$contents=file("comments.txt");
$formated_comments=$format[0];
for($a=0;$a<count($contents);$a++) {
$formated_comments.=preg_replace("^/\[(.*?)\](.*?)/$",$format[1].'$1'.$format[2].$format[3].'$2'.$format[4],$contents[$a]);
}
$formated_comments.=$format[0];
?>

example page (will display the comments):

<html>
<head>
</head>
<body>
<?php
include("read.php");
echo $formated_comments;
?>
</body>
</html>

Benedizione
02-12-2008, 03:38 AM
I am getting this error message. What does this mean? If a database is setup then what is keeping it from connecting? It connected with another program I tried.


>>
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/b/e/n/benedizione/html/test.php on line 29

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/content/b/e/n/benedizione/html/test.php on line 30

Warning: mysql_query(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/b/e/n/benedizione/html/test.php on line 33

Warning: mysql_query(): A link to the server could not be established in /home/content/b/e/n/benedizione/html/test.php on line 33

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/b/e/n/benedizione/html/test.php on line 36
<<

Dre

Medyman
02-12-2008, 01:16 PM
$conn = mysql_connect("localhost","user","password");
mysql_select_db("database_name",$conn);

Change the highlighted portions of the above line to reflect the details for your own setup.
Also make sure you've created a MySQL table called "comments" (or change the name in the script if you name it something else)

Benedizione
02-12-2008, 04:54 PM
Yea, I already tried that and I am still having problems.

However, I am receiving very rude feedback from the tech support of dynamic drive. I may be forced to leave this forum altogether. Maybe they should send me to prison for having used "a font".

If there is a rule about using "fonts" in this forum then the "font options" need to be removed altogether. This is truly absurd and insulting.

Thank you all for your help if I do not get an opportunity to say another word. I may need to look elsewhere for script help.

Dre

Master_script_maker
02-12-2008, 05:42 PM
are you pointing the php code to your mysql server, or your homepage?
correct:
mysql_connect("http://mysql_install_path.domain.com/","user","password");
or:
mysql_connect("http://www.domain.com/mysql_install_path/","user","password");
incorrect:
mysql_connect("http://www.domain.com/","user","password");

Benedizione
02-18-2008, 05:27 AM
Yes, I have the database, user and password correct. In fact, I created 2 mysql databases - one in 4.1 and the other 5.0 because I thought the error message was related to that but it was not.

This is the page now. Where are the boxes to make a post? What am I doing wrong here? I think I am overlooking something simple.

http://propheciesofrevelation.org/test.php

Benedizione
02-18-2008, 07:09 AM
In my table called "comments", do I create 2 "fields" -- one called "name" and the other called "comments"?

Do I only make one table for the one database? And then with two fields?

Or are more tables and fields involved that I am not figuring out?

Dre

jackbenimble4
02-18-2008, 02:46 PM
Okay, a database can only hold many tables but you will only need one. "comments" is a fine name for the table. If you want to collect both their name and a comment, you will need two fields in the table. One for the comment and one for the name.

In order to get data from the user, you need to use html to place forms for them to use. Here's an example:



<form method="post" action="submit.php">
<p>Name: <input type="text" name="name" /></p>
<p>Comment:</p>
<textarea rows="5" cols="40" name="comment"></textarea>
<p><input type="submit" value="Post Comment" />
</form>



Then in submit.php, you would have to get that data and store it into the database:


<?php

if(isset($_REQUEST['name']) && isset($_REQUEST['comment'])) {

$conn = mysql_connect("localhost","user","password");
mysql_select_db("database_name",$conn);

mysql_query("INSERT INTO comments (name, comment) VALUES('".mysql_real_escape_string($_REQUEST['name'])."', '".mysql_real_escape_string($_REQUEST['comment'])."' ");

echo "Thank you, your comment has been submitted.";

}

?>



Then you could use something similar to what I posted on page 2 to view the comments.

Benedizione
02-18-2008, 04:14 PM
Everything is almost working, but how do I get the comments to post back to the main page? What word do I need to replace here?

This is my submit.php page. Isn't it something on here that I need to change? Comments.txt, perhaps?


<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'];
fwrite($file,$contents);
fclose($file);
}
?>

Master_script_maker
02-18-2008, 07:14 PM
after it submits you want it to go to the main page?


<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'];
fwrite($file,$contents);
fclose($file);
header("Location: http://www.yoursite.com/main_page.php");
}
?>

Jas
02-18-2008, 08:49 PM
However, I am receiving very rude feedback from the tech support of dynamic drive. I may be forced to leave this forum altogether. Maybe they should send me to prison for having used "a font".

Please don't take offense. People don't like when you over-use fonts/formatting (Based on your previous post, you probable made the font size bigger? Those things should usually be used sparingly). It's nothing personal--we want you to stay on DynamicDrive-- it's just a reminder to keep posts simple.

BTW, do you mean pulling the comments back out of the database? That would take a MySQL Query.

$rows = MySQL_Query("SELECT * FROM comments");
while($row = MySQL_Fetch_array($rows)){
echo $row['comment'];
}
(that's a very basic example)

If you want to display the results from newest to oldest, you need to add another column to your table, either a time of an ID to sort by.

Benedizione
02-18-2008, 11:09 PM
Is that where the posts are going? To the database? I wondered where they were going. lol

Okay, the mysql query code goes on which page? The test.php or submit.php? Seems like the code should be placed on the test.php page....placed on the page where I want the posts to appear. Would that be correct?

By "another column to your table" do you mean "field"? Create another field and call it "time" or "ID"?

thetestingsite
02-18-2008, 11:16 PM
Is that where the posts are going? To the database? I wondered where they were going. lol


Are you using the code you posted here:



<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'];
fwrite($file,$contents);
fclose($file);
header("Location: http://www.yoursite.com/main_page.php");
}
?>


If so, then they are being written to the file comments.txt. In order to read that file, you would want to put the following on the page that you want the comments to be displayed.



<?php
foreach (file('comments.txt') as $comment) {
echo $comment.'<br><hr><br>';
}
?>


Hope this helps.

Benedizione
02-18-2008, 11:55 PM
Yes, that is the code I am using.

Place this code onto my main page where I want the comments to appear?

<?php
foreach (file('comments.txt') as $comment) {
echo $comment.'<br><hr><br>';
}
?>


I have been playing around with it different ways. When I place it on the page where I want the comments to appear, then the page is messed up and this link shows up "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ".

My experiment page is here http://www.propheciesofrevelation.org/test.php

I am not planning to keep the page test.php. I am trying to experiment with that page as a main page so that I do not interfere with the main website. When I get this code figured out then I will integrate it into the main site on the appropriate page.

Dre

Master_script_maker
02-19-2008, 12:29 AM
please post all of your code

Benedizione
02-19-2008, 01:01 AM
Okay, I have 3 pages right now... test.php, submit.php, comments.txt


Here is what is on my test.php page (I am withholding my database link and pswd). I think that I must have some words/pages mixed up.

<h1>Comments</h1>
<?php

// read comments from the database, a text file, a xml file, whatever

// loop through comments, and for each one:
echo "<p>".$comment['text']."</p>";


?>




<?php

$conn = mysql_connect("database_link","revelation13","password");
mysql_select_db("revelation13",$conn);

// get all the rows from the table named 'revelation13' in the database 'revelation13'
$getCommentsQuery = mysql_query("SELECT * FROM comments");

// this loops through the results from the query
while($row = mysql_fetch_array($getCommentsQuery)) {
// $row will be an associative array of data for a row during each iteration

// print the data that's in the column 'comments'
echo "<p>".$row['comments']."</p>";
}

?>


<form method="post" action="submit.php">
<p>Name: <input type="text" name="name" /></p>
<p>Comment:</p>
<textarea rows="5" cols="40" name="comment"></textarea>
<p><input type="submit" value="Post Comment" />
</form>


<?php
foreach (file('comments.txt') as $comment) {
echo $comment.'<br><hr><br>';
}
?>



Here is what is on my submit.php page:

<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'];
fwrite($file,$contents);
fclose($file);
}
?>



<?php

if(isset($_REQUEST['name']) && isset($_REQUEST['comment'])) {

$conn = mysql_connect("database_link","revelation13","password");
mysql_select_db("revelation13",$conn);

mysql_query("INSERT INTO comments (name, comment) VALUES('".mysql_real_escape_string($_REQUEST['name'])."', '".mysql_real_escape_string($_REQUEST['comment'])."' ");

echo "Thank you, your comment has been submitted.";

}

?>



<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'];
fwrite($file,$contents);
fclose($file);
header("Location: http://wwww.propheciesofrevelation.org/test.php");
}
?>



My comments.txt page:

<!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" lang="en" xml:lang="en">
<head>
<title></title>

</head>

<form action="submit.php" method="post">
Name: <input type="text" name="name"><br>
Comment:<br>
<textarea name="comments"></textarea>
<input type="submit" name="submit" value="Send">
</form>

</html>

Benedizione
02-23-2008, 04:18 AM
I've been thinking about your question of what page I want to return to after submit. I would like for the page to return to the page where the person types in their post, the page where I intend to have other html on the page. I want to be able to see the post immediately after submitting.

How do I get it to do that?

Because when I write in the test.php page where comments.txt is now, the page goes only to the submit.php page after clicking on submit.

Dre

Master_script_maker
02-23-2008, 04:31 PM
you might want to look over your code, you're trying to write it to a database and a text file, but the text file looks like it contains html when it shouldn't contain anything but what the php file wrote to it. try going back to page 2 where i give you a script. don't combine it with mysql and read all of the instructions and comments.
change read.php:

for($a=0;$a<count($contents);$a++) {
$formated_comments.=preg_replace("^/\[(.*?)\](.*?)/$",$format[1].'$1'.$format[2].$format[3].'$2'.$format[4],$contents[$a]);
}
$formated_comments.=$format[0];
?>
with:

for($a=0;$a<count($contents);$a++) {
$formated_comments.=preg_replace("^/\[(.*?)\](.*?)/$",$format[1].'$1'.$format[2].$format[3].'$2'.$format[4],$contents[$a]);
}
$formated_comments.=$format[5];
?>

Benedizione
02-25-2008, 04:08 AM
Okay, I re-read everything. I removed the database info from everything again. And, I changed the code in the read.php file. I removed everything from the comments.txt page but it seems like that page is not doing anything. Are the comments supposed to appear on comments.txt?

Can I place the "example form" on the same page where I want to "echo the comments"?

I tried that and then I get this error: Warning: preg_replace(): No ending delimiter '^' found in /home/content/b/e/n/benedizione/html/read.php on line 30

Dre

Master_script_maker
02-25-2008, 08:29 PM
Here is the working, customizable code. It will create comments.txt so you don't have to. The table's class is comments, the td's class that contains the name is name, and the td's class that contains the comment is text.

Leafy
02-25-2008, 10:15 PM
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body>
<div id="container">
<p><a href="..">Back to Tests</a></p>
<p>
If you submit a piece of text, this page will modify itself.<br />
</p>
<!-- COMMENTS START -->

<!-- COMMENTS END -->
<form method="post" action="write.php">
<textarea name="content" cols="20" rows="6">Test 1234</textarea>
<input type="submit" value="Submit" />
</form>
</div>
</body>
</html>



<?php
if(isset($_POST["content"])) {
$content = $_POST["content"];
$content = strip_tags($content);
$fc = file_get_contents("index.php");
$seek = "<!-- COMMENTS START -->";
$start = stripos($fc,$seek)+strlen($seek)+1;
$split = explode($seek,$fc);
$split[0] .= "\n<p>" . $content."</p>";
$split = implode($seek,$split);
$h = fopen("index.php","w+");
fwrite($h,$split);
fclose($h);
Header("Location: index.php");
}
?>

Benedizione
02-26-2008, 04:03 AM
Here is the working, customizable code. It will create comments.txt so you don't have to. The table's class is comments, the td's class that contains the name is name, and the td's class that contains the comment is text.
After I click on "send" the "submit.php" page comes up and says "page not found". Then when I "refresh" the page, the page comes up blank. How do I get the page to go back to the form.php page after clicking on "send"?

Benedizione
02-26-2008, 04:07 AM
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<meta http-equiv="content-type"
content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body>
<div id="container">
<p><a href="..">Back to Tests</a></p>
<p>
If you submit a piece of text, this page will modify itself.<br />
</p>
<!-- COMMENTS START -->

<!-- COMMENTS END -->
<form method="post" action="write.php">
<textarea name="content" cols="20" rows="6">Test 1234</textarea>
<input type="submit" value="Submit" />
</form>
</div>
</body>
</html>



<?php
if(isset($_POST["content"])) {
$content = $_POST["content"];
$content = strip_tags($content);
$fc = file_get_contents("index.php");
$seek = "<!-- COMMENTS START -->";
$start = stripos($fc,$seek)+strlen($seek)+1;
$split = explode($seek,$fc);
$split[0] .= "\n<p>" . $content."</p>";
$split = implode($seek,$split);
$h = fopen("index.php","w+");
fwrite($h,$split);
fclose($h);
Header("Location: index.php");
}
?>

How would I use this code?

It looks like it would place the comments on the same page as does the other code given to me, but also send me back to the same page instead of to a submit.php page?

Benedizione
02-26-2008, 04:11 AM
Here is the working, customizable code. It will create comments.txt so you don't have to. The table's class is comments, the td's class that contains the name is name, and the td's class that contains the comment is text.
Do I need to type in "propheciesofrevelation.org" where it says "localhost"? Or do I just leave that?


<?php
if(isset($_POST['submit']) && $_POST['name'] != null && $_POST['comments'] != null) {
if(!is_file("comments.txt")) {
$write=fopen("comments.txt","x+");
fclose($write);
}
$file=fopen("comments.txt","r+");
$contents=fread($file,filesize("comments.txt")+1);
$contents=$contents."\n[".$_POST['name']."]".$_POST['comments'].";";
fwrite($file,$contents);
fclose($file);
header("Location: http://localhost/comment/form.php");
}
?>

Master_script_maker
02-26-2008, 08:24 PM
yes. change it to the location of the form.

Leafy
02-27-2008, 12:54 AM
How would I use this code?

It looks like it would place the comments on the same page as does the other code given to me, but also send me back to the same page instead of to a submit.php page?

You could put the first page on an "index.php" page and the second page on a "write.php" page.

Benedizione
02-27-2008, 04:18 AM
yes. change it to the location of the form.
How can I tell how many characters are allowed in a comment box? Is there a way that I can change that number?

Benedizione
02-27-2008, 05:01 AM
I think that I finally have this thing working but now I am trying to make sure that the page is protected from anyone clicking on the back button and entering the page or forwarding into the page or "refreshing" back into the page.

Backward and forward are protected, but I just "refreshed" the page and was taken back into it without entering the passcode. How can I fix that? Does it have anything to do with the meta tags?

Not sure if I am allowed to ask this question here since it still pertains to the same page in this thread or if I am supposed to start a new thread.


<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Prophecies of Revelation</title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="rating" content="General">
<meta name="revisit-after" content="">
<meta name="robots" content="">
<meta name="distribution" content="">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

Master_script_maker
02-27-2008, 10:44 AM
you can set the max length. in the form page set the textarea maxlength attribute

Benedizione
03-02-2008, 02:30 AM
Is there a way that I can clear the comments from the board periodically?

When I tried to access the comments.txt file that was created, it would not allow me to.

Dre

Benedizione
03-02-2008, 02:49 PM
Is there a way that I can clear the comments from the board periodically?

When I tried to access the comments.txt file that was created, it would not allow me to.

Dre
Well, nevermind. I finally accessed the file. I don't know why it was so difficult to access. I thought there might be a trick to this but apparently not.

Thanks!