PHP,will,show,create,simple,guestbook
Quick Search for:  in language:    
PHP,will,show,create,simple,guestbook
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
PHP Stats

 Code: 74,754 lines
 Jobs: 12 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for PHP.
Smart Image Navigator
By Brian Di Croce on 10/27


Click here to see a screenshot of this code!Form security verification
By Christian Mallette on 10/26

(Screen Shot)

Click here to see a screenshot of this code!Guestbook
By Nightmare on 10/25

(Screen Shot)

Shout! Box
By Nightmare on 10/23


SERVER-TO-SERVE R site (or single dir) transfer
By Raffaele Marranzini on 10/22


Site IP Logger - Watch who comes to your site!
By KRaZY-DeSiGN on 10/21


IP Banner - Block unwanted people from your site!
By KRaZY-DeSiGN on 10/20


PWGen
By Flinn Mueller on 10/19


URHere
By Flinn Mueller on 10/19


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Guest Book without MySQL

Print
Email
 

Submitted on: 8/12/2002 7:30:40 AM
By: As absurd as it sounds, we have to give a name... 
Level: Beginner
User Rating: By 1 Users
Compatibility:PHP 3.0, PHP 4.0

Users have accessed this article 1979 times.
 

(About the author)
 
     This will show you how to create a simple guestbook in PHP.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
Section 1: Why I made it

I wanted a guestbook for my website but the server didn't support mySQL. So I made this. (It's not very good because I only started learning PHP last week).

Section 2: The HTML

Create an HTML file called anything you like (I called mine form.html). It should have something like this in it:



<br> Guestbook<br>



Name:








Section 3: The PHP

Make a PHP file called process.php and write the following:

$store = "store.dat";
if ($action == add) {
echo "Thankyou $name, Your message has been submitted

";
$opener = fopen($store,"a");
fputs($opener, "Name:
$name

Message:
$message



");
fclose($opener);
echo "To view the messages, click here";
} else if ($action == view) {
$table = join('', file($store));
echo "$table";
} else if ($action == clear) {
$opener = fopen($store,"w");
fputs($opener, "");
fclose($opener);
echo "Table cleared";
}
?>

Section 4: The DAT File

Create an empty file called store.dat. Thats it!

Section 5: Uploading and Enjoying

Upload the three files and CHMOD the DAT to 666 (-rw-rw-rw)(read all write all).
If you go to process.php?action=view, then you will be able to view the guestbook. If you go to process.php?action=clear, you will clear the guestbook.
Hope you enjoy it!

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
8/13/2002 6:58:26 PM:Horacio
The code is not working... when I hit submit, it gives me some errors in the process.php file. Error: Undefined variable: action Maybe someone can look at the code and post it again?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/14/2002 5:54:12 PM:Charles Chadwick
Well, just by looking at it, although I could be wrong, where it says if ($action == clear) clear should be in quotes, such as if ($action == "clear") same with $action == view and $action == add. I myself got a different error, "parse error, unexpected $". I'll see if I can get it working. A valiant effort none the less by the author.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/16/2002 5:51:19 AM:As absurd as it sounds, we have to give a name...
Horacio, I forgot to include a line of script that is very important. You need to add a: <input type=hidden name=action value=add> Sorry! Charles, yes, you can use quotes but it is not essential. I'm not sure about the error - I'll try and work it out.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/21/2002 10:38:42 PM:HellOnComputer
a few little tweaks and it wouldnt be too bad. (try <br> instead of pressing enter in echo)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/23/2002 5:32:00 AM:mike
ive never done php before what do you mean by CHMOD the DAT to 666 (-rw-rw-rw)(read all write all).????
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/23/2002 2:43:24 PM:Charles Chadwick
chmod is setting file permissions on a unix/linux machine. I suggest doing a search on google for how to do that, there's probably a better explanation of it somewhere on the net than I can provide here.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/2/2002 12:39:39 PM:As absurd as it sounds, we have to give a name...
Thankyou everyone for your feedback, and please vote for me! Cheers!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/3/2002 4:53:01 AM:
great! this was just what i was looking for, simple and working! add a few html- tags to the proess.php file and you can make your own style gb. love it!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/13/2002 4:17:45 PM:Darryl Porter
This is a good an simple script. In reference to the comment above, quote are not needed in the "if statements" if the server running the script is on a Unix based system. However, Window Based Operating systems aren't as forgiving. You will need to put either single or double quotes in else you will receive an error. It is a good idea to put them in anyway--it makes for clean cross-platform codes.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/4/2002 10:49:05 AM:
does not work, i get a load of c rap when i press submit, it looks like its showing all the php code, when i add a <?php tag to the PHP file, it shows BLANK.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | PHP Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.