Welcome to WebmasterWorld Guest from 107.22.14.254

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

html and CGI

how to get an html out put from a CGI script

     
4:36 pm on Aug 5, 2008 (gmt 0)

5+ Year Member



can any one help me to figure out how to get an html form from a CGI script and how to test if your CGI script works in a server.

this is a script that im using

#!/usr/bin/perl -wT

use strict;
use CGI;

my $q = new CGI;
my $timestamp = localtime;

print $q->header( "text/html" ),
$q->start_html( -title => "The Time", -bgcolor => "#ffffff" ),
$q->h2( "Current Time" ),
$q->hr,
$q->p( "The current time according to this system is: ",
$q->b( $timestamp ) ),
$q->end_html;

Thanks

[edited by: phranque at 9:01 pm (utc) on Aug. 5, 2008]
[edit reason] hosting specifics [/edit]

4:54 pm on Aug 5, 2008 (gmt 0)

5+ Year Member



The code you posted looks OK. If the very first line is correct for your server, it should work. But this is not tech support for your host, you should ask them how to run CGI scripts on their servers. Most web hosts have instructions posted on the website somewhere.

[edited by: phranque at 9:01 pm (utc) on Aug. 5, 2008]
[edit reason] hosting specifics [/edit]

5:01 pm on Aug 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



does your error logs show anything?

I have run into some some setups that simple perl files wouldn't work, yet placing use CGI::Carp qw(fatalsToBrowser); in the file made it work? I'm no perl expert ;)

10:19 pm on Aug 5, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



what is the HTTP response when you GET the script?
4:53 pm on Aug 6, 2008 (gmt 0)

5+ Year Member



I found how to make CGI scripts into html form by using the command prompt window. So its no longer a problem for me.

[edited by: phranque at 11:26 pm (utc) on Aug. 6, 2008]
[edit reason] removed duplication [/edit]

2:53 pm on Aug 13, 2008 (gmt 0)

5+ Year Member



The main problem was that I was starting with CGI so I had no idea about what you guys ment by HTTP reponce of error logs and i solved my problem and it was a problem with my variables
 

Featured Threads

Hot Threads This Week

Hot Threads This Month