Jump to content

I Need Some Shoutbox Help...

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...