Previous Thread
Next Thread
Print Thread
Rate Thread
#101958 01/12/2001 11:23 AM
Joined: Jan 2001
Posts: 6
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 6
Hiya...
How would i do to create a script that takes the value from 2 or more form fields and adds it then puts it out into another field?
Kinda like... uh...

Price: 2
Shipping: 4

Total: 6

Im a newbie to CGI so please keep it simple if you can help [Linked Image]

Thanks...

Sponsored Links
Joined: Aug 2000
Posts: 37
Member
Member
Offline
Joined: Aug 2000
Posts: 37
umm... thats kinda easy here!
-----------------code-------------------
#!/usr/bin/perl
use CGI qw(:standard);
print "Content-type: text/htmlnn";

$var1 = param('fieldname');
$var2 = param('fieldname2');
#if it is supposed to be mathamatical

$added = $var1 + $var2;

print "your text here $var1
" ;
print "your text here $var2
" ;
print "
";
print "your text here $added
";

------------------
check out my site at http://www.ultimategamers2000.com

Joined: Sep 2000
Posts: 138
Em8 Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
Well the full script:

#!/usr/bin/perl
use CGI qw(:standard);
print "Content-type: text/htmlnn";
$var1 = param('fieldname');
$var2 = param('fieldname2');
$act = param('act');
#if it is supposed to be mathamatical

if ($act eq ""){
&main;
}else{
&total;
}
sub main{
print<


Enter number of some thing you want:
Enter number of some thing else you want:
MAIN
}
sub total{
$added = $var1 + $var2;

print "your text here $var1
" ;
print "your other text here $var2
" ;
print "
";
print "your text here $added
";
}

------------------

Joined: Aug 2000
Posts: 37
Member
Member
Offline
Joined: Aug 2000
Posts: 37
smart ass [Linked Image]

------------------
check out my site at http://www.ultimategamers2000.com

Joined: Sep 2000
Posts: 138
Em8 Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
Well its true! [Linked Image]

------------------

Sponsored Links
Joined: Jan 2001
Posts: 6
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 6
Thanks a lot [Linked Image])
I'll go to try it now [Linked Image]

Joined: Jan 2001
Posts: 6
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 6
Hmm...
This doesnt show the total untill i push submit..
Any way to make it show it as soon as i enter the numbers?

Joined: Sep 2000
Posts: 138
Em8 Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
That would be javascript.

------------------

Joined: Jan 2001
Posts: 6
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 6
Aww damn [Linked Image]
Any idea how to do that? hehe

Joined: Sep 2000
Posts: 138
Em8 Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
No.

------------------

Sponsored Links
Joined: Sep 2000
Posts: 138
Em8 Offline
Member
Member
Offline
Joined: Sep 2000
Posts: 138
Well:
Code
code:

I think

------------------


This message has been edited by Em8 on January 14, 2001 at 11:56 AM

Joined: Jan 2001
Posts: 6
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 6
Well, thanks for your help..
But i cant get it to work, hehe, i'll ask in the java forum


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 254
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)