Welcome to WebmasterWorld Guest from 54.160.177.33

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)

New User

5+ Year Member

joined:July 17, 2008
posts:30
votes: 0


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)

Preferred Member

10+ Year Member

joined:Jan 5, 2006
posts:536
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 29, 2002
posts:1954
votes: 0


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)

Administrator

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

joined:Aug 10, 2004
posts:10542
votes: 8


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

New User

5+ Year Member

joined:July 17, 2008
posts:30
votes: 0


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)

New User

5+ Year Member

joined:July 17, 2008
posts:30
votes: 0


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