Listing 3. posting-add.tcl

ad_page_contract {

  Add a new posting

  @author Reuven M. Lerner (<
  @date 2002-September-18
} {
  posting_text:trim
} -properties {
}

# Get the current user's ID
set user_id [ad_get_user_id]

# Create an SQL query for inserting the new entry
set sql "INSERT INTO atf_hello_postings
           (user_id, posting)
         VALUES (:user_id, :posting_text)"

# Insert the posting
db_dml insert_posting $sql

ns_returnredirect posting