Good day...
I have this small cgi form the problem is that the variables won't pass to split.. but when I give a direct value to the variables everything is ok...
here is the code *note the unreadable characters are Arabic please ignore them:
#!/usr/bin/perl
use utf8;
use Switch;
use CGI;
$cgi = new CGI;
print $cgi->header(-charset=>'UTF-8'),
$cgi->start_html
(
-title=>'Mahsoob Script'
),
$cgi->h1('Mahsoob script'),
$cgi->start_form
(
-method=>'post',
-action=>''
),
"Textbox: ",
$cgi->textfield(-name=>'name',-size=>20), $cgi->br, "\n",
"Textbox: ",
$cgi->textfield(-name=>'mom',-size=>20), $cgi->br, "\n",
"Textbox: ",
$cgi->textarea(-name=>'tarekh',-coloumns=>20,-rows=>5), $cgi->br, "\n"
+,
$cgi->submit(-value=>'submit'), $cgi->br, "\n",
$cgi->end_form;
print "<br>";
$name = $cgi->param('name');
$mom = $cgi->param('mom');
$tarekh = $cgi->param('tarekh');
%freq = (
--arabic characters and their values
);
%freq2 = (
--arabic characters and their values
);
$namesum = 0;
for (split //, $name) {
$namesum += $freq{$_};
}
$momsum=0;
for (split //, $mom) {
$momsum += $freq{$_};
}
$sum=$namesum+$momsum;
print "Sum: $sum\n";
$modulus =$sum%12;
switch ( $modulus )
{
--12 different cases , simple print statement
}
print $modulus;
$cgi->end_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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.