Page 47 - LoudOffice_Guide-to-HTML_Part-II_Advanced.PDF
P. 47
< t d > N u m b e r o f Y e a r s : < / t d >
< t d > < i n p u t n a m e = " y r s " t y p e = " t e x t " v a l u e = " 3 0 " s i z e = " 3 " > < / t d >
< / t r >
< / t a b l e >
< i n p u t t y p e = " s u b m i t " v a l u e = " C a l c u l a t e P a y m e n t " >
< / f o r m >
< h r >
E O F
} e l s e {
# T h e f o r m h a s b e e n s u b m i t t e d , d i s p l a y o u t p u t .
# ( $ p m i n , $ p m a x , $ i m i n , $ i m a x , $ t e r m ) = s p l i t ( " & " , $ a r g s ) ;
@ v = s p l i t ( " & " , $ a r g s ) ; $ t b l = " N " ;
f o r ( $ i = 0 ; $ i < = $ # v ; $ i + + )
{
( $ k e y , $ v a l ) = s p l i t ( " = " , @ v [ $ i ] ) ;
$ v a l = ~ s / % ( [ \ d a - f ] { 1 , 2 } ) / p a c k ( C , h e x ( $ 1 ) ) / e i g ;
$ v a l = ~ s / , / / g ;
$ a a { $ k e y } = $ v a l ;
}
$ y r s = $ a a { " y r s " } ;
$ i n t = $ a a { " i n t " } ;
$ a m t = $ a a { " a m t " } ;
$ t t = $ y r s * 1 2 ;
p r i n t " < h e a d > < t i t l e > Y o u r M o n t h l y P a y m e n t < / t i t l e > < / h e a d > \ n " ;
p r i n t " < b o d y b g c o l o r = f f f f f f > \ n " ;
p r i n t " < c e n t e r > < h 1 > Y o u r M o n t h l y P a y m e n t < / h 1 > " ;
p r i n t " I f y o u t a k e a l o a n f o r $ y r s Y e a r s < b r > " ;
p r i n t f ( " w i t h a n I n t e r e s t R a t e o f % 6 . 3 f % % < b r > " , $ i n t ) ;
p r i n t f ( " f o r a L o a n o f \ $ % 9 . 2 f : < b r > " , $ a m t ) ;
$ m i = $ i n t / 1 2 0 0 ;
$ t e m p = ( 1 . 0 / ( 1 + $ m i ) * * $ t t ) ;
i f ( $ t e m p < 1 )
{
$ p m t = $ a m t * $ m i / ( 1 - $ t e m p ) ;
}
e l s e { $ p m t = $ a m t / $ t t ; }
p r i n t f ( " t h e n y o u r p a y m e n t w i l l b e \ $ % 9 . 2 f a M o n t h ! " , $ p m t ) ;
p r i n t " < h r > < / c e n t e r > \ n " ;
}
p r i n t " < / b o d y > \ n " ;
p r i n t " < / h t m l > \ n " ;
This can be downloaded at http://www.loudoffice.com/class/media/simple_cgi.txt. Make
sure to save it as simple.cgi.
Accessing CGI Scripts Directly
If you have a CGI script that can be accessed directly, all you need to do is link to the CGI
file. For example, if you had a CGI guestbook, and you wanted to create a link to the file,
you could simply link to it:
V i s i t o u r < a h r e f = ” . . / c g i - b i n / g u e s t b o o k . c g i ” > O n l i n e G u e s t b o o k < / a > .
You can also use a frames page in order to maintain the look of your site or control
navigation:
< h t m l >
LoudOffice.com Guide to HTML – Part II Page 47