:- ['/usr/local/lib/prolog/html.pl'].

main :-
  html_get_form_input(Info),
  html_get_value(Info,person_name,Name),
  response(Name,Response),
  output_html([
    form_reply,
    start,
    image('http://www.clip.dia.fi.upm.es/images/clip.gif'),nl,
    heading(2,'Toy Address Server'),
    --,
    Response,
    form('http://www.clip.dia.fi.upm.es/cgi-bin/html_simple_form'),
    'Click here, enter name, and press return:', 
    \\,
    input(text,[name=person_name,size=20]),
    end_form,
    end]).

response(Name, []) :- 
	html_empty_value(Name), !.
response(Name, ['Available info on ', bf(Name), ':', Info]) :-
	info(Name,Info), !.
response(Name, ['No available info on ', bf(Name), '.']).

info(clip,   '+341-336-7448').
info(manuel, '+341-336-7435').
info(daniel, '+341-336-7448').

:- save_cgi_bin(html_simple_form,main).
