CS205 Tables & Forms © 2012 D. J. Foreman
Tables © 2012 D. J. Foreman
Basic <table>Syntax <table cols=# of columns > <tr> defines one ROW <td></td> defines one CELL <td></td> </tr> more rows </table> © 2012 D. J. Foreman
Major <TABLE> attributes border border thickness (e.g. 4) cellpadding margin around text cellspacing between cells cols helps compute table width frame border around whole table rules inside borders width whole table © 2012 D. J. Foreman
Syntax for Table Cells <th align=… colspan=… rowspan=… valign=… > Options only affect current cell <td> uses same options as <TH> <caption> applies a title to top of table © 2012 D. J. Foreman
Forms © 2012 D. J. Foreman
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 © 2012 D. J. Foreman
Caution Don't confuse the terminology: OPTION as a tag: OPTION actually an attribute on a tag <BODY bgcolor='red'> © 2012 D. J. Foreman
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> </tr> </table> </form> © 2012 D. J. Foreman
<Form> methods Post Get 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 © 2012 D. J. Foreman
<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 © 2012 D. J. Foreman
CGI's CGI programs can be written in: A CGI always runs on the server 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: Dr. Foreman's CS105 Grade Tracker © 2012 D. J. Foreman