Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

How do I get a CGI form to work?

A reader writers:
"I'm trying to create a guestbook using the forms and CGI's, but I'm stuck as to how to link the form to the server. The sign page is at <guestadd.html> and I would like the view page to be at <guestbook.html>. What I did was use a somewhat template form of guestbook provided by our web host, and, after editing the sign page (new additions are "Current Division" and "Mu Alpha Theta Chapter"), wanted the additions to appear on guestbook.html, but I don't know how to do that..."

Dave's Answer: I think that the most confusing part of the Web is the Common Gateway Interface, and much of that is because there's programming involved. :-) Seriously, you've got the basics figured out, but remember that the guestbook script that you're using from your Web hosting provider is a program, so if you want to modify the input fields, you need to modify the script to see them, accept them, and include them in the output file. Talk with your admin about whether you can have a copy of their script in your own directory so that you can make these changes.

In terms of view page link, more likely than not it'll be a .cgi URL not a .html URL as you indicate in your message: what's their recommended link for allowing someone to just see the guestbook without adding a new entry?

Still have questions? Come back and post a Q&A and we can discuss this further!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

An additional note: All HTML pages are fundamentally static: you create the page you want, you preview it in your browser, and you're good to go. It's uploaded to your server and it's done. With CGI, however, everything's different. A CGI-based page is generated on-the-fly as the output of a program that's run on your server.

That means that for a guestboook to work, you need to have a cgi program that can accept the guestbook data, do something with it (probably write it to a file or insert it into a database) and output a meaningful result (probably a 'thanks for submitting your comments' message). Typically, you'd have a static HTML page that asks for entries (a form, built within the <form> tag pair) which feeds its data to your add-guestbook-entry CGI script. That script then either outputs the existing guestbook as a nice HTML page, or outputs a 'thank you'. Then you need a second script (or the same script with enough smarts to see if there's a new entry or just a display request) that outputs the guestbook data.

This is pretty complex just writing about it here, so here's a good tutorial by Joel Burns with extensive example listings.

Posted by: Dave Taylor at June 29, 2003 7:52 AM

You have done an exceptional job in creating and designing this website. My Congratulations to you!!!

Posted by: junw at March 1, 2004 3:51 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]