guestbook

Simple MySQL Guestbook

Creating the guestbook has two parts, the table to hold the guestbook records and the script to insert and select records from the database
table.

The structure of the table should look similar to this:

CREATE TABLE guests (
id int(10) unsigned NOT NULL auto_increment,
guest varchar(50) NOT NULL default '',
message varchar(200) NOT NULL default '',
date datetime default NULL,
PRIMARY KEY (id)
) ;

The guestbook script has three sections - the code for the form, the code for saving the form data, and the code for displaying the data.

      Subscribe in a reader

Flash Guestbook V2

Creating a guestbook in Flash using PHP script and a MySQL database

Setting up the database

You will need to have access to a server running PHP and MySQL. If you use another database, replace the MySQL database functions that I use in the PHP script with the database functions for the other database i.e. PostgresSQL, MSSQL.

First create two tables in the database:

# This table will hold the guestbook entries.
# Table structure for table `flashgb`
#

CREATE TABLE flashgb (
id int(4) NOT NULL auto_increment,
name varchar(20) NOT NULL default '',

      Subscribe in a reader

Flash - PHP Guestbook: part 2

Second steps in creating a Flash - PHP guestbook

Processing variables sent from Flash to PHP.

The guestbook script that process the variables is very simple. It checks to see if all the variables have a value. If one of the variables is empty, the script redirects the browser to the HTML page with the Flash movie, otherwise it prints the variables.

PHP Code:

<?php
if (($homepage == "") || ($email == "") || ($name == "") || ($comments == "")) {
header("Location: guestbook.html");
exit;
}
?>

<HTML>
<HEAD>
<TITLE>Guestbook Submission information</TITLE>
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<div align=center>

<P>Thanks, <font color="red"><?php echo "$name"; ?></font>.<br>
(Email: <a href="mailto:<?php echo "$email"; ?>"><?php echo "$email"; ?></a>),
<br>Homepage: <a href="<?php echo "$homepage"; ?>"><?php echo "$homepage"; ?></a> <br>

<P>Comments: <?php echo "$comments"; ?></p>
</div>

</body>
</html>

See it in action. ¦ Get complete code.

      Subscribe in a reader

Flash - PHP Guestbook: part 1

First steps in creating a Flash - PHP guestbook

Sending variables from Flash to PHP.

I decided to try my hand at creating a Flash SWF (Flash 5) that would interact with PHP.

I created a very simple contact form in Flash:

The first frame of the Flash movie has a stop action on the frame, four input text fields and two buttons (send and clear) on the stage.

The input text fields:

The name, homepage and email input text fields should have the 'Single Line' and 'BorgerBg' options selected.

      Subscribe in a reader
Syndicate content