Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
HTML form post & custom menus
sdohar
My custom menu creates an HTML form post that should kick off another CGI. I was careful to use the absolute path in the form post, yet is does nothing!
print qq{<FORM name="$FORMNAME" action="/usr/iw-home/httpd/iw-bin/$MYNAME" method="post">\n};
Am I missing something?
Find more posts tagged with
Comments
akshathp
IN my opinion this would not work as even though you mean to supply the absolute path, but while rendering the page, server will need to know from doc root. Whereas, docroot will be as per what is already set for your server.
I mean, "/usr/iwhome...." will have a prefix of "
http://servername/...
."
Or maybe I am missing something.
Akshat Pramod Sharma
Interwoven Inc.
sdohar
I also tried with the
http://IP/usr/iw-home.....
.", still nothing.
akshathp
Yes even this owuldn't work as the absolute path of your fiel system is not necessarily the URL for your web applications.
You will need to find from you sys admin for this server to let you know what would be the URL for you.
I can guess in your case it should be
http://IP/iw-bin/
.....
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
sdohar
http://IP/iw-bin/
.... works when I type it into a web browser, however it still doesn't work when I try to invoke it from my FORM post! I must be missing something, but I have no clue what.
akshathp
Can you post your code after these changes?
Akshat Pramod Sharma
Interwoven Inc.
sdohar
here's my FORM post...if the problem isn't obvious here, I can post the rest of my script with it...
print qq{<FORM name="$FORMNAME" action="
http://10.24.216.100/iw-bin/$MYNAME"
method="post">\n};
akshathp
Yup, detailed code would certainly help in identifying the issue.
I am assuming that the CGI that you are executing exists in your iw-bin folder.
Akshat Pramod Sharma
Interwoven Inc.
sdohar
#!/usr/iw-home/iw-perl/bin/iwperl
use CGI;
use DBI;
use Env;
use LWP::UserAgent;
use LWP:
imple;
use HTTP::Request;
use HTTP::Response;
#-------------------------------------------------------------
# Constants and configuration
#-------------------------------------------------------------
$ENV{"ORACLE_HOME"} = "/data/OraHome1/";
$MYNAME = "delete_duplicate.cgi";
if($^O eq "MSWin32") { $MYNAME =~ s!.*\\!!; }
else { $MYNAME =~ s!.*/!!; }
$FORMNAME = "my_form";
$APPNAME = "Duplicate URLs";
my $cgi = new CGI;
#-------------------------------------------------------------
# Main Logic
#-------------------------------------------------------------
&StartPage;
&Main;
&StartForm;
&EndForm;
&EndPage;
exit(0);
##############################################################
# SUB-ROUTINES
##############################################################
# Common User interface routines
#-------------------------------------------------------------
# Print common TeamSite CGI page header
#-------------------------------------------------------------
sub StartPage
{
print $cgi->header();
print $cgi->start_html(-title=>"$APPNAME", -BGCOLOR=>'#c0c0c0');
print "<TABLE BORDER=0 cellpadding=2 cellspacing=0 WIDTH=100%><TR><TD ALIGN=\"LEFT\">";
print "<Font size=3><B>$APPNAME</B></font></TD>\n";
print "<TD ALIGN=\"RIGHT\"><IMG src=\"/iw-icons/iwtslogo.gif\"></TD>\n";
print "<TR BGCOLOR=\"#c0c0c0\"><TD ALIGN=LEFT></FONT></TD>";
print "</TABLE>";
}
#-------------------------------------------------------------
# Print common TeamSite CGI page footer
#-------------------------------------------------------------
sub EndPage
{
print "</BODY></HTML>";
}
#-------------------------------------------------------------
# Print common form header
#-------------------------------------------------------------
sub StartForm
{
# print qq{<FORM name="$FORMNAME" action="/iw-bin/iw_cgi_wrapper.cgi/$MYNAME" method="post">\n};
print qq{<FORM name="$FORMNAME" action="
http://10.24.216.100/iw-bin/$MYNAME"
method="post">\n};
}
#-------------------------------------------------------------
# Print common form end.
#-------------------------------------------------------------
sub EndForm
{
print "</FORM>\n";
}
# Application-Specific User interface routines
#-------------------------------------------------------------
# main interface routine
#-------------------------------------------------------------
sub Main
{
&ShowInfo;
}
#-------------------------------------------------------------
# interface sub-routine
#-------------------------------------------------------------
sub ShowInfo
{
my $db = "DBI
racle:db1";
my $username = "pwgsc_metadata";
my $password = "password";
my $dbh = DBI->connect($db, $username, $password) or die "Couldn't connect to database: " . DBI->errstr;
if ($dbh)
{
my $st = $dbh->prepare("Select URL from METADATA_TABLE group by URL having count(*) > 1");
$st->execute() or die "Couldn't execute statement:".$st->errstr;
my
@data
;
while (
@data
= $st->fetchrow_array)
{
print "$data[0]\n";
}
print "<BR><INPUT type='submit' value =' Delete Duplicates '>";
#$dbh->disconnect;
}
}
jbonifaci
Well, your main problem is that your submit button is not inside the form. Another thing you might want to change is the hard coding of the script name/url. Instead do something like this:
my $MYURL = $ENV{'SCRIPT_URL'};
print qq{<FORM name="$FORMNAME" action="$MYURL" method="post">\n};
Hope this helps,
Jeff Bonifaci
sdohar
Wow, that was embarrassing! Thanks for looking things over, it really was as simple as that!