Hi,

I have been playing with a guestbook CGI script that saves the guestbook form as JavaScript Function Calls gbF() in a file called gbookFXXX.js

Include the guestbook data in you web page and use JavaScript to process the data.

Once downloaded you can sort, select and format.

You have the data to validate the next guestbook entry.

You can turn a static web page into a dynamic web page.

Great for simple applications like sports club results pages, events diaries, booking systems.

I have written up my ideas at:

http://www.btinternet.com/~doug.h.rice/gbbook/index.htm

Some code:

store the following into gbookFXXXX.js

gbF(
"doug", "d@g", "28/10/02 07:53:02", "127.0.0.1",
"userfield1",
"userfield2",
"userfield3",
"userfield4",
""
);


gbF(
"doug", "doug@somewhere", "Wed, 30 Oct 2002 08:45:28 UTC+0100", "193.113.37.9",
"A",
"userfield2",
"userfield3",
"userfield4",
"This is a test"
);


included into a Web Page:

<html>
<body>
<script>

function gbF( name,email,postedOn,IPaddress,userfield1,userfield2,userfield3,userfield4,comments){

self.document.write(
"<Tr>"+
"<TD >"+ name+ "</TD><TD >"+ email+"</TD><TD >"+ postedOn+"</TD>"+
"<TD >"+ IPaddress+ "</TD>"+
"<TD >"+ userfield1+"</TD><TD >"+ userfield2+ "</TD>"+
"<TD >"+ userfield3+"</TD><TD >"+ userfield4+ "</TD>"+
"<TD >"+ comments+ "</TD>"+
"</TR>"
)
}

</script>

<h4> One line of the table </h4>

<table border=2 >

<script language="JavaScript" >

gbF(
"name","email","postedOn", "127.0.0.1",
"userfield1", "userfield2", "userfield3", "userfield4",
"comments"
);

</script>
</table>

<h4> Now include the data from the guestbook </h4>

<table border=2 >
<!-- local guestbook in same place as guestbook.asp -->
<script language = "JavaScript" type = "text/javascript"
src = "./gbookFXXX.js" >

</script>

<!-- remote guestbook-->
<script language = "JavaScript" type = "text/javascript"
src = "http://www.dougrice.webhoster.co.uk/public/gbookFXXX.js" >
</script>

</table>

</body>
</html>

My web site has a perl, asp and a trial PHP guestbook script.

I started by modifing Matt Wright's perl guestbook script:
with:


$N = $FORMJS{'guestbook'};

open (GUESTFJS,">>$guestbookjsf$N.js") || &file_error( GUESTJS, "$guestbookjsf$N.js" );
print GUESTFJS "gbF( \n";
print GUESTFJS "\"$FORMJS{'name'}\",";
print GUESTFJS "\"$FORMJS{'email'}\",";
print GUESTFJS "\"$date\",";
print GUESTFJS "\"$ENV{'REMOTE_ADDR'}\",\n";
print GUESTFJS "\"$FORMJS{'userfield1'}\",\n";
print GUESTFJS "\"$FORMJS{'userfield2'}\",\n";
print GUESTFJS "\"$FORMJS{'userfield3'}\",\n";
print GUESTFJS "\"$FORMJS{'userfield4'}\",\n";
print GUESTFJS "\"$FORMJS{'comments'}\"\n";
print GUESTFJS ");\n";
close (GUESTFJS);


if ( $FORMJS{'loadnextpage'} ){

# Print Out Initial Output Location Heading
print "Location: $FORMJS{'nextpage'}\n\n";
exit;
}

There are live demos of some of the possibilties.

Advantages:

You use a stable server side cgi script, and develop your web pages on your client machine, off line.

JavaScript's sort fuctions is very powerful.

Great for applications that just need a sorted list.

You get an audit trail of all submits.

Makes JavaScript really powerful.

The data can be included in lots of different pages.

Saves a lot of learning ( and stress ) about server side coding.

Quick for rapid prototyping.

I place this idea into the public domain for any ISP to provide like BTOpenworld.

I want BTOpenWolrd to add it to their CGI scripts. See their guestbook help page at:

http://www.btopenworld.com/create/we...,6668,,00.html

Happy Scripting,

Dougy Rice