Jump to content

I Need Some Shoutbox Help...


rubdoo
 Share

Recommended Posts

Hey guys, I'm not so great when it comes to PHP. I just started learning it like... 2 days ago. Basically, I want to make a very simple shoutbox thing. I uploaded it to 000webhost at the domain http://chatgalore.co.cc/Here it is:

<!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=utf-8" /><title>ChatGalore</title></head><body><form action="index.php" method="post">Name: <input style="position:relative;left:22px;" type="text" name="name" /><br />Comment: <input style="width:200px;" type="text" name="comment" /><br /><input type="submit" value="Post Comment" /></form><?php $name = $_POST["name"]; ?><?php $comment = $_POST["comment"]; ?><?php echo $name; ?>:<?php echo $comment; ?><br /></body></html>

I got the really basic stuff done. I just need to make it keep whatever the user wrote... like... when you click submit it posts the comment, but when you do it again, it just overwrites it... I have no clue on how to make it stay there. Also, the colon just stays there all the time... haha :) . Anyways, if anyone can teach me how to fix my problems, I'd appreciate it. Thanks.

Link to comment
Share on other sites

You have a colon here<?php echo $name; ?>:To keep the information, you need to store it in either a file or database (this one is preferred). In your script, you are just outputting (displaying the text) the information the user submitted, and that is it. You are not saving the information. Continue on learning from the w3schools tutorials, reading the forum topics here and other tutorials, and visit the php.net page to learn about PHP and mysql.com to learn about MySQL relation database management system.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...