SUBROUTINE FORMHFA
* Display a simple form, with name and address fields and an
* Image button to submit the form

* Include the RealWeb definitions
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

* Get the URL of the Reality item server
IMAGE = ""
CALL RW_GET_PARAM("__isurl", IMAGE)
* Specify the location of the image
IMAGE = IMAGE : "/REALWEB-ITEMS/books.gif"

* Start the HTML page
CALL RW_START_HTML_PAGE("Name and Address Details", "", "", "", "")

* Start the HTML form, specifying that the subroutine FORMHF2A
* should be run when the form is submitted
CALL RW_START_HTML_FORM("FORMHF2A", "NAMEFORM", "")

BUF="Enter your name and address, then click on the books to continue"
CALL RWA_NEWLINES(BUF,2)

* Create the editboxes
BUF=BUF:"Name:    "
CALL RWA_EDIT_BOX(BUF,"NAME", 30,"")
CALL RWA_NEWLINES(BUF,1)
BUF=BUF:"Address: "
CALL RWA_EDIT_BOX(BUF,"ADD1", 30,"")
CALL RWA_NEWLINES(BUF,1)
BUF=BUF:"       "
BUF=BUF:"       "
CALL RWA_EDIT_BOX(BUF,"ADD2", 30,"")
CALL RWA_NEWLINES(BUF,1)
BUF=BUF:"       "
BUF=BUF:"       "
CALL RWA_EDIT_BOX(BUF,"ADD3", 30,"")
CALL RWA_NEWLINES(BUF,1)
BUF=BUF:"Postcode:   "
CALL RWA_EDIT_BOX(BUF, "PCODE", 7, "")
CALL RWA_NEWLINES(BUF,2)

*Create the image button
CALL RWA_IMAGE_BUTTON(BUF, "BOOKS", "Reader Details", IMAGE, "")

*Display the form
CALL RW_PUT(BUF)
*Complete the form
CALL RW_END_FORM
* Complete the page
CALL RW_END_PAGE
RETURN
SUBROUTINE FORMHF2A
*Request further information from reader who supplied name & address

*Include the RealWeb definitions
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

*Start the HTML page
CALL RW_START_HTML_PAGE("Reader Details", "", "", "", "")

*Get the name and postcode from the initial form
CALL RW_GET_PARAM("NAME", NAME)
CALL RW_GET_PARAM("ADD1", ADD1)
CALL RW_GET_PARAM("ADD2", ADD2)
CALL RW_GET_PARAM("ADD3", ADD3)
CALL RW_GET_PARAM("PCODE", PCODE)

*Set up the lists of descriptions and values for the select list
VALUE_TEXT=""
VALUE_TEXT<1>="Crime and Thrillers"
VALUE_TEXT<2>="Historical"
VALUE_TEXT<3>="Classics"
VALUE_TEXT<4>="Science Fiction"

VALUE=""
VALUE<1>="Crime and Thrillers"
VALUE<2>="Historical"
VALUE<3>="Classics"
VALUE<4>="Science Fiction"

*Start the HTML form, specifying that HFCONFIRM should be run
*when the submit button is clicked
CALL RW_START_HTML_FORM("HFCONFIRM","FICTION","")

BUF="Now select your preferred type of fiction from the list"
CALL RWA_NEWLINES(BUF, 3)

*Put the name and address into hidden fields
CALL RWA_HIDDEN(BUF, "READERNAME", NAME, "")
CALL RWA_HIDDEN(BUF, "READERADD1", ADD1, "")
CALL RWA_HIDDEN(BUF, "READERADD2", ADD2, "")
CALL RWA_HIDDEN(BUF, "READERADD3", ADD3, "")
CALL RWA_HIDDEN(BUF, "READERPCODE", PCODE, "")

*Create the select list
CALL RWA_SELECT_LIST(BUF, "LIST1",VALUE_TEXT,VALUE,"","")

*Create the submit button
CALL RWA_SUBMIT_BUTTON(BUF, "GO","")

*Display the form
CALL RW_PUT(BUF)

*Complete the form
CALL RW_END_FORM
* Complete the page
CALL RW_END_PAGE
RETURN
SUBROUTINE HFCONFIRM
*Confirm information supplied on the previous two forms

*Include the RealWeb definitions
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

*Start the HTML page
CALL RW_START_HTML_PAGE("Reader Details", "", "", "", "")

*Get the name and address entered on the first form
*(submitted as hidden fields with the second form)
CALL RW_GET_PARAM("READERNAME", READERNAME)
CALL RW_GET_PARAM("READERADD1", READERADD1)
CALL RW_GET_PARAM("READERADD2", READERADD2)
CALL RW_GET_PARAM("READERADD3", READERADD3)
CALL RW_GET_PARAM("READERPCODE",READERPCODE)

*Get the type of fiction selected from the list
CALL RW_GET_PARAM("LIST1", FICTION)

CALL RW_PUT("You have supplied the following details:")
CALL RW_NEWLINES(2)
CALL RW_PUT(READERNAME)
CALL RW_NEWLINE
CALL RW_PUT(READERADD1)
CALL RW_NEWLINE
CALL RW_PUT(READERADD2)
CALL RW_NEWLINE
CALL RW_PUT(READERADD3)
CALL RW_NEWLINE
CALL RW_PUT(READERPCODE)
CALL RW_NEWLINES(2)
CALL RW_PUT("Preferred type of fiction:")
CALL RW_NEWLINE
CALL RW_PUT(FICTION)

* Complete the page
CALL RW_END_PAGE
RETURN
ClosedResult
ClosedHTML