Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: How to bind html page with PERL script to accept user input to Mysql database (eg. Phonebook)

by poj (Abbot)
on Jul 04, 2013 at 08:50 UTC ( [id://1042387]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to bind html page with PERL script to accept user input to Mysql database (eg. Phonebook)
in thread How to bind html page with PERL script to accept user input to Mysql database (eg. Phonebook)

Adjust your form tag to location of cgi script like this <form method="post" action="/cgi-bin/subfolder/sqlconfig.cgi">. Put the html page in the htdocs folder.

In your cgi script I suggest to keep the database/sql processing separate and put all the cgi at the end of the script like this

my $message; if ($rv == 1){ $message = q(Record has been successfully updated !!!); }else{ $message = q(<b style="color:red">Error!!while inserting records</b +>); ## exit; } # return to html page my $URL = '/contactsform.html'; my $refresh = 5; print $q->header( -type=>"text/html", -expires=>"-1m" , -refresh=>"$refresh ; URL=$URL" +); print $q->start_html, $q->p($message), $q->p( qq!This page returns to $URL in $refresh seconds, Click <a href="$URL">here</a> to return now! ), $q->end_html;

It would be advisable to add use strict but you will need declare all your variables with my. I can't see any reason to our

Also, whilst testing you might find it useful to add use CGI::Carp 'fatalsToBrowser' but remove it when the script is working.


poj
  • Comment on Re^3: How to bind html page with PERL script to accept user input to Mysql database (eg. Phonebook)
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: How to bind html page with PERL script to accept user input to Mysql database (eg. Phonebook)
by newtoperl101 (Novice) on Jul 04, 2013 at 17:32 UTC
    It worked. Very cool. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1042387]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-19 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found