1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Simple PHP Guestbook?

Discussion in 'Web Design' started by Desertfox, Mar 14, 2012.

  1. Desertfox

    Desertfox Regular Member

    Joined:
    Nov 13, 2011
    Messages:
    200
    Likes Received:
    37
    Occupation:
    Sysadmin
    Location:
    Europe
    Hello.

    Im looking for a simple PHP Guestbook Script.
    There are so many these days.

    Which one is most often used & developed?

    Thanks :)
     
  2. backlinks1

    backlinks1 Junior Member

    Joined:
    Jul 13, 2011
    Messages:
    139
    Likes Received:
    43
    this my first simple script that i learnt
    step by step
    #1 Create database GuestBook
    in database GuestBook create table about guest
    Code:
    -> name varchar(40) null,
    -> location varchar(40) null,
    -> email varchar(40) null,
    -> url varchar(40) null,
    -> comments text null 
    
    #2 code
    create hi.php by notepad or any program that you can do
    Code:
    <? php
    echo "hi, guys." ;
    $var = date("H");
    if ($var <= 11)
    {
    echo "good morning";
    }
    elseif ($var > 11 and $var < 18)
    {
    echo "good afternoon";
    }
    else
    {
    echo "good evening";
    }
    ?> 
    
    then you execute connect database
    Code:
    <? php
    mysql_connect("localhost", "root","kkk") or
    die ("Could not connect to database");
    mysql_select_db("guestbook") or
    die ("Could not select database");
    ?> 
    
    save code in connectdb.php
    #3 create form to submit data
    create a form by HTML code ( you can do by yourself)
    and you can test on local host ( install xampp to run)

    Edit by jazzc: Please don't forget to add code tags, it makes everything more readable ;)
     
    • Thanks Thanks x 1
    Last edited by a moderator: Mar 21, 2012