Home    News    Product    Order    Forum    Feedback    Partner    Profile  © Neatware 2000
 Neatware Snaml
Search
  Introduction
Home  : Last Update: Wed Apr 12 19:59:38 2000

 
Snaml -- XML

 
Snaml Basic
      Introduction
      Syntax
      Control
      Types
      Modules
      Status
Snaml HTML
      HTML
      Structure
      Link
      Objects
      Text
      Font
Snaml CSS
      CSS
      Script
Snaml CGI
      CGI
      Variables
      Output
      Form
      Application
Snaml XML
      XML
      Document
      EBNF
  1. Guestbook

    User fills his/her name, email address, and comments in a client form page, after clicking the send button, the information is sent to the CGI program on a server. Then CGI program will email the information in the readable format to the author of the web and response a HTML page to user. This is a simple Guestbook. It consists of a form page and a CGI program. The form page code of Snaml is

    _html
    _head 
      _title; _quote "Guestbook"; title_
    head_
    _body
      _h2; _quote "Guestbook"; h2_
      _form "action='/cgi/guestbook.cgi' method='post'"
      _table "border=0"
        _tr
          _td "width='54%'" 
            _quote "Your Name:"
          td_
          _td 
            _input "type='text' name='user' size='20'"
          td_
        tr_
        _tr
          _td "width='54%'" 
            _quote "Email Address:"
          td_
          _td
            _input "type='text' name='email' size='20'"
          td_
        tr_
      table_
      _quote "Comments:" 
      _p
      _textarea "rows='10' cols='40' name='comment'"
        _quote "Guestbook."
      textarea_
      _p
      _input "type='submit' name='sendname' value='send'"
      _input "type='reset' value='clear'"
    form_
    body_
    html_
    

    The CGI program guestbook.cgi on the server parses the data, sends email to author, and responses a HTML page to client user. The source cod is

    #!/usr/local/bin/tclsh8.0
    _cgi {Content-type: text/html}
    _html
      _head 
      _title
        _quote "Guestbook Response"
      title_
      head_
      _body
        if {[string compare [ParseForm sForm] RESULT_OK] == 0} {
          _quote "your input is:"
          _p
          foreach item $sForm {
            _quote "$item=$sForm($item)"
            _p
          }
        }
    
        # send email to author
        set to "To:info@neatware.com"
        set from "From:$sForm(email)"
        set subject "Subject:$sForm(user)"
        set content "$sForm(comment)" 
        set mail "$to\n$from\n$subject\n$content"
        exec sendmail -t -n $mail
      body_
    html_
    		

  2. Query

    .

  3. Test

    .

Guestbook

Query

Test

     
Home  : Last Update: Wed Apr 12 19:59:38 2000
Search
  Introduction
 Neatware Snaml
Home    News    Product    Order    Forum    Feedback    Partner    Profile  © Neatware 2000