updater

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Locked
benslayton
Forum Newbie
Posts: 12
Joined: Tue Jun 06, 2006 3:08 pm

updater

Post by benslayton »

I have 3 php pages....

*index.php

Code: Select all

<html>
<head>
<title>Comment Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
  <div align="left">
    <table width="80%" border="" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left">
            <?php
               if ($file = @file_get_contents("comments.phpdata")) {
                echo $file."\n";
                }
            else {echo "Sorry, but no comments were found.";}
        ?>
        </td>
      </tr>
    </table>
  </div>
  <p align="left"><a href="add.php">Add Comment</a></p>
</div>
</body>
</html>

*add.php

Code: Select all

<html>
<head>
<title>Add Comment Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center"> 
  <p><font size="+1">Add Comment Demo:</font></p>
<form name="form1" method="post" action="sent.php">
    <textarea name="comment" cols="60" rows="10"><?php
      if ($file = @file_get_contents("comments.phpdata")) {
         echo $file."\n";
          }
         else {echo "Sorry, But your page is blank";}
		 ?></textarea><br>
    <input type="submit" value="submit">
  </form>
    <a href="index.php">Back</a>
</div>
</body>
</html>

*sent.php

Code: Select all

<?php

$filename = "comments.phpdata";
if ($name = stripslashes($_POST['comment'])) {
    $comment = str_replace("<","<",$comment); //security
    $comment = str_replace(">", ">", $comment); //security

    $file = @fopen($filename, "w+");
    @fwrite($file, $comment);
    @fclose($file);
    $message = "Your comment was successfully added.<br>Redirecting to index.php";
    }
else {
    $message = "You either entered no data or it was entered incorrectly.<br>Redirecting to index.php";
    }
?>
<html>
<head>
<title>Comment Added Demo</title>
<meta http-equiv="refresh" content="3;url=index.php">
</head>
<body>
<div align="center"> 
<p><font size="+1">Comment Added Demo:</font></p>
<?php echo $message; ?>
</div>
</body>
</html>
I am having problems with my text box on add.php. I when you try to make a new paragraph, it only makes spaces. Need help. :excl:

you can view it here:http://benslayton.awardspace.com[/url]
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

This seems to be cross posting. the other thread is right here: viewtopic.php?t=49669
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Erm, Double posting isn't cool :(
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:3. Do not make multiple, identical posts. This is viewed as spam and will be deleted.
Locked