611 likes | 2.03k Views
CS205. Tables & Forms. Tables. Basic <table>Syntax. <table cols = # of columns > <tr> defines one ROW <td></td> defines one CELL <td></td> </tr> more rows </table>. Important <TABLE> Options. border border thickness (e.g. 4) background bordercolor
E N D
CS205 Tables & Forms
Basic <table>Syntax <table cols=# of columns > <tr> defines one ROW <td></td> defines one CELL <td></td> </tr> more rows </table>
Important <TABLE> Options • border border thickness (e.g. 4) • background • bordercolor • cellpadding/cellspacing • cols helps compute table width • frame borderaround whole table • rules cell borders • height • width
Advanced <Table> Syntax • <TH align=… background=… bgcolor=… colspan=… rowspan=… valign=… width=…> • <TD same options as TH> • <caption align=…> • Options only affect current cell
Basic <Form> Syntax -1 • <form action=URL method=(post/get)> • <input name="field1"> • <select> • <option value="value1"> </option> • more option tags • </select> • </input> • </form> Usually uses a TABLE to line up fields
Caution • Don't confuse the terminology: • OPTION as a tag: • <OPTION> • OPTION actually an attribute on a tag • <BODY bgcolor='red'>
Basic <Form> Syntax -2 • <form action=URL method=(post/get)> • URL is to locate the CGI program • CGI = Common Gateway Interface • <table> • <tr> • <td><input></input></td> • <td><input></input></td> • </tr> • </table> • </form>
<Form> methods • Post • preferred • data accessed via "standard input" • (standard input/output is terminal I/O) • Get • less common (limited length) • data passed as a parameter • contains callers URL • URL could be truncated
<FORM> processing • User clicks a "submit" button • Browser send data to server • Server starts the CGI program • Server gives data to CGI program • CGI program "builds" a webpage • Output via "standard output" • Contains HTML tags AND text • Server sends "page" to browser • Browser displays page
CGI's • CGI programs can be written in: • Perl, Java, C++, C, etc. • A CGI always runs on the server • User cannot see the CGI program • Sometimes called a "script" • MS script files: anypage.ASP • CGI Example: • D. Foreman's CS105 grade calculator