Hi Everyone,

Does anyone know of a website that tells you in simple terms how to create a guestbook please?

Ive signed up to a free one and paid to have no ads on but i would really like to have one without a link on the bottom

thanks a lot!!!

Recommended Answers

All 5 Replies

Can you be more clear with your question? There are a couple of ways to collect a users information when they visit a website.

You could start with an html form.

What information would you like to collect?

hi thanks for that,

sorry i should have been a bit more clear.

It is basically for people to enter comments on the guestbook about a dog website. Im looking for it to display
~ Name
~ Website
~ Message

I can do the layout etc of how I would like it to look, but Im struggling with what I need to do for it to display as the most recent message once they press submit.

I would like the message to display beneath where they enter their comments and for their message to appear straight away rather than doing it manually??

Thanks again

I know a way to make a external page guestbook (a whole page on your website) but if you just want it inserted into a page then ask again and Ill look around...

Here is a script for it > http://www.promosi-web.com/script/guestbook/download

To use it > 1.Open up index.php and edit all the variables
2. Upload index.php and gbook.dat to the website(CHMOD gbook.dat to 666 (writable))
3. Upload all the .GIF files to the same website directory.

If you get any errors then tell me... The main error is when people dont CHMOD the gbook.dat and you get a writable error.

You could use this mysql/php

MYSQL

CREATE TABLE `guestbook`.`guests` (
  `guest_id` INT NOT NULL AUTO_INCREMENT,
  `fname` varchar(55) NOT NULL,
  `lname` varchar(55) NOT NULL,
  `website` varchar(200),
  `comment` text,
  PRIMARY KEY (`guest_id`)
)
CHARACTER SET utf8;

and this PHP

<?php
$con = mysql_connect("localhost","username","password");

//Must create db on server
mysql_select_db("guestbook", $con); //this name is for demo purposes

//table created is named 'guests'
mysql_query("INSERT INTO guests (fname, lname, website,comment) 
VALUES ('$_POST[fname]', '$_POST[lname]', '$_POST[website]','$_POST[comment]')");

//This displays the guestbook form html
echo "
	<html>
	<h1>Please sign-in to our guestbook</h1>
	
	<form  name='guestbook' action='{$_SERVER['PHP_SELF']}' method='post'>
	<p><label for='fname'>First Name</label><br />
	<input type='text' name='fname' value=''></p>
	
	<p><label for='lname'>Last Name</label><br />
	<input type='text' name='lname' value=''></p>
	
	<p><label for='website'>website</label><br />
	<input type='text' name='website' value=''></p>
	
	<p><label for='comment'>Your Comment</label><br />
	<textarea cols='20' rows='10' name='comment' value=''></textarea></p>
	<p><input type='submit' value='submit'></p>
	</form>
	</html>";

//This is where the comments will be pulled from the database and displayed below the guestbook form.
$result=mysql_query("select * from guests");
	while ($row=mysql_fetch_assoc($result)){
			echo"<div style='background-color:#ccc; padding:1em; width:20%;'>
			<p>Name: {$row['fname']}  {$row['lname']}</p>
			<p>Website: <a href='{$row['website']}'>{$row['website']}</a></p>
			<p>Comment: {$row['comment']}</p></div>
			<hr />";
			}
mysql_close($con)
?>

This should get you started but you will want to read about security cuz this example is filled with holes.

Hope it helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.