The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Need help with my form, Probably something really simple...
rockerdom
post Sep 27 2007, 10:53 PM
Post #1





Group: Members
Posts: 3
Joined: 27-September 07
Member No.: 3,921



Here is the completed, working script.


QUOTE
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<font size="1" face="Verdana">
<body bgcolor="#c0c0c0" onload="calculate();">
<strong><script type="text/javascript">
function cent(amount) {
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
function calculate() {
var p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14;
p1 = test.price1.value * 1;
p2 = test.price2.value * 1;
p3 = test.price3.value * 1;
p4 = test.price4.value * 1;
p5 = test.price5.value * 1;
p6 = test.price6.value * 1;
p7 = test.price7.value * 1;
p8 = test.price8.value * 1;
p9 = test.price9.value * 1;
p10 = test.price10.value * 1;
p11 = test.price11.value * 1;
p12 = test.price12.value * 1;
p13 = test.price13.value * 1;
p14 = test.price14.value * 1;
total_price = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12 + p13 + p14;
test.total_price.value = cent(Math.round(total_price*Math.pow(10,2))/Math.pow(10,2));
}
</script></strong>
<form id="test" name="test" action="" method="post">
<strong>
<input type="hidden" value="xx.xx" name="price1">
<input type="hidden" value="xx.xx" name="price2">
<input type="hidden" value="xx.xx" name="price3">
<input type="hidden" value="xx.xx" name="price4">
<input type="hidden" value="xx.xx" name="price5">
<input type="hidden" value="xx.xx" name="price6">
<input type="hidden" value="0.00" name="price7">
<input type="hidden" value="xx.xx" name="price8">
<input type="hidden" value="0.00" name="price9">
<input type="hidden" value="0.00" name="price10">
<input type="hidden" value="0.00" name="price11">
<input type="hidden" value="0.00" name="price12">
<input type="hidden" value="0.00" name="price13">
<input type="hidden" value="0.00" name="price14"></strong>
<p><strong></strong> </p>
<p> </p>
<p><b>Processors</b></p>
<p><select onchange="this.form.price1.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D1">

<option value="xx.xx">AMD Sempron 64 3400+ Manila 1.8GHz Socket AM2 </option>
<option value="xx.xx">AMD Athlon 64 3500+ Orleans 2.2GHz Socket AM2</option>
<option value="xx.xx">AMD Athlon 64 4000+ Orleans 2.6GHz Socket AM2</option>
<option value="xxx.xx" selected="">AMD Athlon 64 X2 4400+ Brisbane 2.3GHz Socket AM2 [ Recommended ]</option>
<option value="xxx.xx">AMD Athlon 64 X2 4600+ Windsor 2.4GHz Socket AM2</option>
<option value="xxx.xx">AMD Athlon 64 X2 5000+ Brisbane 2.6GHz Socket AM2 </option>
<option value="xxx.xx">AMD Athlon 64 X2 5200+ Windsor 2.6GHz Socket AM2 </option>
<option value="xxx.xx">AMD Athlon 64 X2 5600+ Windsor 2.8GHz Socket AM2</option>
<option value="xxx.xx">AMD Athlon 64 X2 6000+ Windsor 3.0GHz Socket AM2</option>
</select></p>
<p><b>Motherboards - All of our systems are built with upgrading in mind. Make sure to select a motherboard that meets
your needs. Not sure which one you need? Email us, and we will help you through the process!</b></p>
<p><select onchange="this.form.price2.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D2">
<option value="xx.xx" selected="">
GIGABYTE GA-M61SME-S2 AM2 NVIDIA GeForce 6100 Micro ATX AMD Motherboard [Non-SLI, 8GB Max Memory]
</option>
<option value="xxx.xx">
MSI K9N4 SLI-F AM2 NVIDIA nForce 500 SLI MCP ATX AMD Motherboard [SLI, 8GB Max Memory]
</option>
<option value="xxx.xx">
ASUS M2N-E SLI AM2 NVIDIA nForce 500 SLI MCP ATX AMD Motherboard [SLI, 8GB Max Memory, Faster PCI-E]
</option>
</select></p>
<p><b>Memory</b></p>
<p><select onchange="this.form.price3.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D3">
<option value="xx.xx">
WINTEC AMPX 1GB (1 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400)
</option>

<option value="xx.xx" selected="">
A-DATA Value Series 2GB (2 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400)
</option>

<option value="xxx.xx">
G.SKILL 2GB (1 x 2GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400)
</option>


<option value="xxx.xx">
G.SKILL 4GB(4 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400)
</option>

<option value="xxx.xx">
OCZ Gold 4GB(4 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400)
</option>

</select></p>
<p><b>Hard Drive</b></p>
<p><select onchange="this.form.price4.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D4">
<option value="xx.xx">
EXCELSTOR Jupiter Series 160GB 7200 RPM SATA 3.0Gb/s [8MB Cache]
</option>
<option value="xx.xx" selected="">
Seagate Barracuda 7200.10 250GB 7200 RPM SATA 3.0Gb/s Hard Drive [8MB Cache]
</option>

<option value="xx.xx">
Western Digital Caviar SE 320GB 7200 RPM SATA 3.0Gb/s Hard Drive [8MB Cache]
</option>

<option value="xx.xx">
SAMSUNG SpinPoint T Series 400GB 7200 RPM SATA 3.0Gb/s Hard Drive [16MB Cache]
</option>

<option value="xxx.xx">
SAMSUNG SpinPoint T Series 500GB 7200 RPM SATA 3.0Gb/s Hard Drive [16MB Cache]
</option>
</select></p>
<p><b>Video Card</b></p>
<p><select onchange="this.form.price5.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D5">
<option value="x.xx">
None, use onboard video...
</option>

<option value="xx.xx">
EVGA GeForce 7300GS 256MB 64-bit GDDR2 PCI Express x16
</option>
<option value="xx.xx">
EVGA GeForce 7600GS 256MB 128-bit GDDR2 PCI Express x16
</option>

<option value="xx.xx">
EVGA GeForce 7600GS 512MB 128-bit GDDR2 PCI Express x16
</option>


<option value="xxx.xx">
MSI GeForce 7900GT 256MB 256-bit GDDR3 PCI Express x16 [HDCP Ready]
</option>


<option value="xxx.xx">
XFX GeForce 7950GT 512MB 256-bit GDDR3 AGP 4X/8X Video Card
</option>


<option value="xx.xx">
MSI GeForce 8400GS Support up to 512M (256MB onboard) 64-bit GDDR2 PCI Express x16
</option>


<option value="xxx.xx">
XFX GeForce 8500GT 512MB 128-bit GDDR2 PCI Express x16 [HDCP Ready]
</option>


<option value="xx.xx" selected="">
MSI GeForce 8500GT 256MB 128-bit GDDR2 PCI Express x16
</option>


<option value="xx.xx">
ASUS SILENT MAGIC/HTP/512M GeForce 8500GT 512MB 128-bit GDDR2 PCI Express x16 [HDCP Ready]
</option>


<option value="xxx.xx">
BIOSTAR GeForce 8600GT 256MB 128-bit GDDR2 PCI Express x16
</option>


<option value="xxx.xx">
BIOSTAR GeForce 8600GT 512MB 128-bit GDDR2 PCI Express x16
</option>


<option value="xxx.xx">
Leadtek GeForce 8600GTS 256MB 128-bit GDDR3 PCI Express x16 [HDCP Ready]
</option>


<option value="xxx.xx">
MSI GeForce 8800Ultra 768MB 384-bit GDDR3 PCI Express x16 [HDCP Ready]
</option>


<option value="xxx.xx">
MSI GeForce 8800GTX 768MB 384-bit GDDR3 PCI Express x16 [HDCP Ready]
</option>
</select></p>

<p><b>Case</b></p>
<p><select onchange="this.form.price6.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D6">
<option value="xx.xx">
JPAC 512 BATTLE SV Silver Steel ATX Mid Tower Computer Case [ Includes 500W Power Supply! ]
</option>
<option value="xx.xx" selected="">
ATRIX Black/Silver Steel ATX Mid Tower Computer Case 480W Power Supply [ Includes 480W Power Supply! ]
</option>


<option value="xxx.xx">
DYNAPOWER USA Blackwidow Steel ATX Mid Tower Computer Case [ Great Look, Includes 500W Power Supply! ]
</option>

</select></p>

<p><b>Larger Power Supplies - Getting SLI or More RAM? Get More Power!</b></p>
<p><select onchange="this.form.price7.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D7">
<option value="xx.xx" selected="">
None Selected...
</option>

<option value="xx.xx">
LOGISYS Computer PS575XBK ATX12V 575W Power Supply [Recommended for SLI and 4GB or more RAM]
</option>
<option value="xx.xx">
ROSEWILL Turbo 550W Power Supply [Recommended for SLI and 2GB RAM]
</option>

<option value="xx.xx">
RAIDMAX 580W Power Supply [Recommended for SLI and 8GB RAM]
</option>
</select></p>

<p><b>Optical Drive</b></p>
<p><select onchange="this.form.price8.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D8">
<option value="xx.xx">
LG 18X DVD±R DVD Burner Black Cache 2MB CD-R 48X CD-ROM CD-RW 32X
</option>
<option value="xx.xx" selected="">
LITE-ON 20X DVD±R DVD 12X DVD-RAM Write Black CD-R 48X CD-ROM CD-RW 32X
</option>
</select></p>

<p><b>Sound Card </b></p>
<p><select onchange="this.form.price9.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D9">
<option value="x.xx" selected="">
None Selected...
</option>

<option value="xx.xx">
Creative Sound Blaster Audigy SE 5.1 Channels
</option>
<option value="xx.xx">
Creative Sound Blaster Audigy SE 7.1 Channels
</option>

<option value="xx.xx">
Creative Sound Blaster X-Fi Xtreme Audio 7.1 Channels
</option>

<option value="xxx.xx">
Creative Sound Blaster X-Fi XtremeGamer 7.1 Channels
</option>

<option value="xxx.xx">
Creative 7.1 Channels Sound Blaster X-Fi Platinum Fatal1ty Champion Series [ With Remote! ]
</option>
</select></p>

<p><b>Keyboard and Mouse</b></p>
<p><select onchange="this.form.price10.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D10">
<option value="x.xx" selected="">
ATRIX Keyboard and Mouse [ Free ]
</option>
<option value="xx.xx">
LOGITECH Wireless Keyboard and Mouse
</option>

<option value="xx.xx">
SPEC RESEARCH MKS-301 Keyboard and Mouse [ Includes 2 Speakers! ]
</option>

<option value="xx.xx">
LOGITECH 967562 Wireless Keyboard and Mouse [ Bluetooth Technology! ]
</option>
</select></p>

<p><b>Speakers</b></p>
<p><select onchange="this.form.price11.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D11">
<option value="x.xx" selected="">
None Selected...
</option>

<option value="xx.xx">
Linkworld 23 Watts 2.1 Speaker System
</option>

<option value="xx.xx">
Cyber Acoustics 45 watts 4.1 Black Speakers
</option>

<option value="xx.xx">
Logitech X-530 70 watts 5.1 Black Speaker System
</option>

<option value="xx.xx">
Creative Inspire 90 Watts 7.1 Speaker
</option>
</select></p>

<p><b>Warranty - All of our systems come with a 1 year manufacturer's warranty that only protects against components that fail
due to faulty construction. Our warranty covers <u> Everything </u>. Breakage, accidental damage, it deosn't matter!
We will replace or repair your system free of charge (except shipping), no questions ask, no terms to study. It's our Sweet
Deal! Compare to leading company warranties that charge twice as much, and don't cover everything like we do!</b></p>

<p><select onchange="this.form.price12.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D12">
<option value="x.xx" selected="">
None Selected...
</option>

<option value="xxx.xx">
1 year Sweet Deal Warranty - Ensure your system beyond the manufacturer's warranty - xxx.xx
</option>
<option value="xxx.xx">
2 Year Sweet Deal Warranty - Ensure your system beyond the manufacturer's warranty - xxx.xx
</option>

<option value="xxx.xx">
3 Year Sweet Deal Warranty - Ensure your system beyond the manufacturer's warranty - xxx.xx [ Recommended ]
</option>

</select></p>
<p><b>Overclocker's Warranty - Make sure your system stays safe and current, even if you overclock!</b></p>

<p><select onchange="this.form.price13.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D13">
<option value="x.xx" selected="">
None Selected...
</option>

<option value="xxx.xx">
1 year Really Sweet Deal Warranty - Ensure your system beyond the manufacturer's warranty - xxx.xx
</option>
<option value="xxx.xx">
2 year Really Sweet Deal Warranty - Ensure your system beyond the manufacturer's warranty - xxx.xx
</option>

<option value="xxx.xx">
3 year Sweet Deal Warranty - Ensure your system beyond the manufacturer's warranty - xxx.xx
</option>
</select></p>

<p><b>Operating System - Get Windows Installed by Our Experts</b></p>

<p><select onchange="this.form.price14.value=this.options[this.selectedIndex].value;calculate()" size="1" name="D14">
<option value="1.00" selected="">
None Selected...
</option>

<option value="xxx.xx">
Windows Vista - 64-bit Ultimate Edition - xxx.xx
</option>
<option value="xxx.xx">
Windows Vista - 32-bit Home - xxx.xx
</option>

<option value="xxx.xx">
Windows Vista - 32-bit Ultimate - xxx.xx
</option>
</select></p>

<p> </p>
<p> </p>
<p><b>Total: </b><br><input readonly="" size="12" name="total_price" font="veranda"></p>
<input type="reset" value="Reset Order Form" name="Reset"><br><br><br><br>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="Vanilla PCs" value="myemail@myemail.com">
<input type="hidden" name="total" value="total">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="shipping" value="49.00">
<input type="hidden" name="on0" value="1000">
<input type="hidden" name="os0" value="1000">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Thank you for your donation!!!">

</form></font></body></html>


Ok, first, I don't know why the submit button isn't working. I need the total_price from the readonly box to be my total for the sale, and it isn't working.

Second, I need a way to apply a 10% discount to the final price to help entice new buyers to my site.

Last, I need a way to know what components are selected by the buyer so I know what components to put in their system.



Any help with this would be greatly appreciated.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Sep 27 2007, 11:17 PM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Um, this page (Where is it? A link is much more useful...) is full of nonsense:

What does <font size="1" face="Verdana"> *between* the head and body mean?

What are lines like <p><strong></strong> </p> supposed to do?

Why is the javascript enclosed in <strong> ?? *$(%^! Have you _any_ idea what "strong" is supposed to mean?

But anyway, your <form> does not include an action, and will never be submitted anywhere, so of course you will never know what buttons the user clicked.

You need to start again, at the beginning.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
rockerdom
post Sep 27 2007, 11:34 PM
Post #3





Group: Members
Posts: 3
Joined: 27-September 07
Member No.: 3,921



No, I don't have any idea what it means, which is probably why I'm having problems. I'm very new to Java, and this was my frist experiment with it.

What sort of action do I need to use?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Sep 27 2007, 11:47 PM
Post #4


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE
No, I don't have any idea what it means, which is probably why I'm having problems. I'm very new to Java, and this was my frist experiment with it.


Um no. "Java" is the name of one programming language; "Javascript" is the name of a *completely different* programming language. The name was chosen by marketing morons to be deliberately confusing.
Javascript is a "client-side" scripting language, which means you can run little bits of program on the user's browser (if they have it enabled), for instance to prove immediately feedback about selections. But javascript doesn't (in general) do anything to notify your server about what's going on.

QUOTE
What sort of action do I need to use?


Your form should submit to a *server* script to process the user input. Try reading the FAQs and stuff about "using forms"; then you probably want to ask the next question in the server-scripting forum below this one.

But it would also help to clean up some of the html nonsense, like all those <strong> tags. What are they supposed to do?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
rockerdom
post Sep 27 2007, 11:56 PM
Post #5





Group: Members
Posts: 3
Joined: 27-September 07
Member No.: 3,921



I guess I should apologize for not knowing any of this. Like I said, I'm very new to all of this, and this was my first try with it. I have been teaching myself all of this, and only started about a week ago.

I thought that the strong tags were required in order to keep the script running smoothly. If that's not true, I can remove them.

So you're saying I need a script running server-side for the form to submit to, and that there is no way to use a submit button to transfer to information selected directly to an email? If that's true, I will go and learn what it is I need to do.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Sep 28 2007, 12:08 AM
Post #6


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Please see the FAQ entry How do I use forms?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th April 2024 - 02:29 AM