I am a newbie too, and I just wrote two pages which do exactly what you suggest (textbox to input tcl/sql, return result to browser). Here's the one for tcl (the sql one I am not happy with yet):
ad_page_contract {
@Author Nis Jorgensen
} {
{script:optional {}}
} -properties {
result
}
if {!is_sitewide_admin_p} {
ad_abort_script
}
set result ""
ad_form -form {
{
script:text(textarea)
{label {Input tcl_script}}
{html {cols 80 rows 10}}
}
} -on_submit {
if {[catch {set result [uplevel $script]}]} {
global errorInfo
set result "ERROR:\n$errorInfo"
}
}