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

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.