Hello again!
Three posts in this forum now, as I am trying to understand how CGI is running and the interaction of the input and output with the server/browser. Very confused with them, especially with the param() function that I was trying to figure out how the parameters of it were passed in between. Say, with the following script, I swallowed it down with little digestion, and it is working. But I do not know how to modify it for my own purpose.
I seem understanding the general idea of the cooperation among CGI, Apache2 and the Browser, but I am not sure, especially, the CGI functions in detail. In this example, I was expecting "key - value" pairs from param() function as
Code:
name Linux
address1 123 streat
address2 Room 123
city New York
State NJ
zip 1X23Y4
country USA
button Enter
but actually nothing was printed. Can anyone explain it for me how these parameters are passed, please? Thanks a lot!
Code:
#!/usr/bin/perl -wT
#textform.pl
use strict;
use CGI;
my $q = CGI->new;
# Starters.
print $q->header, $q->start_html('Address info');
# Create a form with text entry fields.
print $q->start_form,
$q->h1('Please enter your address below.'),$q->p,
'Name:',$q->textfield(-name => 'name'),$q->br,
'Address:',$q->textfield(-name => 'address1'),$q->br,
'Address:',$q->textfield(-name => 'address2'),$q->br,
'City:',$q->textfield(-name => 'city'),
'State/Province:',$q->textfield(-name => 'state'),
'Zip/Postal code:',$q->textfield(-name => 'zip'),$q->br,
'Country:',$q->textfield(-name => 'country'),$q->p,
$q->submit('button','Enter'),
$q->end_form;
print "The parameters of the CGI object (\$q) are: ", "\n";
foreach my $member ($q->param()) { #Line 24
print "$member\t"; #Line 25
} #Line 26
print "\n";
# End the document.
print $q->end_html;
Hi Guys,
I have executed the mail command that has attachment with filename as current date enclosed in system function that is added under awk command.
I have used awk command to check if the error code is present in the file then email command sends an email with subject Error Code ,body... (2 Replies)
I have two variables. I need to call them using the same function
my $dat1 ="abc";
my $dat2 ="def";
my $check;
filecheck($dat1,$dat2);
sub filecheck($)
{
$check = shift;
print "first name is $check\n";
}
print "this is fine\n";
sub filecheck($)
{
$check = shift;
print "second... (2 Replies)
if i create an array of pointers to a structure "struct node" as:
struct node *r;
and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as:
r=multiplty(.......) /*some parameters*/
is... (2 Replies)
Hi All,
I am new to shell scripting required some help in passing the parameter value to the shell script.
I am writing a shell script, in the script I have created two functions as below.
first function
get_trend_ids () {
Here I am connecting to the database and getting all the... (3 Replies)
Hi,
I want to know what exactly bind paameter does?
what exactly bind_param( 1, $siteName ) means?
what 1 means?
In some examples the bind_param is set like this:
bind_param( 2, $siteName1 )
bind_param( 3, $siteName2 )
$sth = $dbh->prepare( "
SELECT name,... (1 Reply)
Hi
I would like to call function in my script couple of times. But each time with different parameters position.
In line 57 I don't know how to call it without typing $1 and $ parameters ?
#!/bin/ksh
2
3
4 function First
5 {
6
7 # $1 - name
8 ... (2 Replies)
Hi, for example I have this function:
function get_param ()
{
test=echo "some string"
test2=echo "someother string"
}
I want to call this function and get test or test2 result, how do I do that ?
Thank you (2 Replies)
Hi!
Some minutes ago I've posted a question related with sed regexps because I need to catch information sended with forms with GET action. This is the post: https://www.unix.com/shell-programming-scripting/127800-regular-expression-sed.html
But now I have a new question. Does cgi scripts have... (0 Replies)
Hi,
I am having a function inside a shell script. The Shell script is called with parameters and one of the parameter is passed to a SQL script inside the function.
But when the function is called inside the shell script, the SQL script is not called.
Do the shell parameter has to be... (3 Replies)