suess0r Posted May 4, 2007 Share Posted May 4, 2007 Hi, I need to build a calculation form.. basically they click a couple radio buttons from features they want and then the user enter's in the number of words of the document and then they hit "calculate" button and it gives them an estimate for a quote. Need a little help with the structure of the form, anyone shed some light? Thanks! Link to comment https://forums.phpfreaks.com/topic/50036-calculation-form-ugg/ Share on other sites More sharing options...
obsidian Posted May 4, 2007 Share Posted May 4, 2007 You'll have to shed a little more light on what type of calculations you're trying to do and what the "radio button features" are and what kind of quote you're calculating. There is really not enough info yet to help build a calculator from. Link to comment https://forums.phpfreaks.com/topic/50036-calculation-form-ugg/#findComment-245625 Share on other sites More sharing options...
suess0r Posted May 6, 2007 Author Share Posted May 6, 2007 I appologize, I'll be more specific.. I'm trying to build a calculation form like the one on http://www.scribendi.com/quote.php?category=26. But a little differently. I want them to pick which type of document they want us to edit, then they enter the number of words in the document (say $.005 for a student document, $.010 for a personal document, etc). So i know that each radio button will serve as the value that will get multiplied by the # of words in their document. But i just need some help organizing it. I have made a calculation type form before that looks like this... But I want the action to happen when they hit "Generate Quote" button, not onchange. So at this point if we could just 2 of them working (below calculations) that would be awesome! Book Author - $.009 / word Student / Academic - $.005 / word <script type="text/javascript"> function checkTotal() { document.listForm.total.value = ''; var sum = 0; for (i=0;i<document.listForm.choice.length;i++) { if (document.listForm.choice.checked) { sum = sum + parseInt(document.listForm.choice.value); } } document.listForm.total.value = sum; } </script> --- <form action="thankyou.php" method="post" enctype="multipart/form-data" name="listForm" id="form1"> <table width="495" border="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC"> <tr> <td width="200" bgcolor="#DAAA59"><div align="center"><span class="style4">Book Author </span></div></td> <td width="235">Are you a book author? Do you want us to edit and proof your book? </td> <td width="38"><div align="center"> <input type="checkbox" name="choice" value="250" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#DAAA59"><div align="center"><span class="style4">Stduent / Academic </span></div></td> <td>A Banner Ad of your choice on our Website's Top Space: (630px X 138px) </td> <td><div align="center"> <input type="checkbox" name="choice2" value="250.00" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#DAAA59"><div align="center"><span class="style4">Business Reports </span></div></td> <td>A Banner Ad of your choice on our side advertisement space: (210px X 115px) </td> <td><div align="center"> <input type="checkbox" name="choice2" value="250.00" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#DAAA59"><div align="center"><span class="style4">Personal Documents </span></div></td> <td>1 Full Selection on our ZCard handout Map </td> <td><div align="center"> <input type="checkbox" name="choice2" value="150.00" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#CCCCCC"></td> <td colspan="2"> <div align="right"><br /> # of words in document: <input name="num-words" type="text" /> </div></td></tr> </table> <br /><input type="submit" name="Submit2" value="Submit Advertisement Request" /> <input name="total" type="text" value="0" /> </form> Link to comment https://forums.phpfreaks.com/topic/50036-calculation-form-ugg/#findComment-246759 Share on other sites More sharing options...
suess0r Posted May 6, 2007 Author Share Posted May 6, 2007 Actually, I appologize. They should be Radio Buttons not checkboxes. Code below, THANKS!! <form action="thankyou.php" method="post" enctype="multipart/form-data" name="listForm" id="form1"> <table width="495" border="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC"> <tr> <td width="200" bgcolor="#DAAA59"><div align="center"><span class="style4">Book Author </span></div></td> <td width="235">Are you a book author? Do you want us to edit and proof your book? </td> <td width="38"><div align="center"> <input type="radio" name="choice" value="250" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#DAAA59"><div align="center"><span class="style4">Stduent / Academic </span></div></td> <td>A Banner Ad of your choice on our Website's Top Space: (630px X 138px) </td> <td><div align="center"> <input type="radio" name="choice2" value="250.00" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#DAAA59"><div align="center"><span class="style4">Business Reports </span></div></td> <td>A Banner Ad of your choice on our side advertisement space: (210px X 115px) </td> <td><div align="center"> <input type="radio" name="choice2" value="250.00" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#DAAA59"><div align="center"><span class="style4">Personal Documents </span></div></td> <td>1 Full Selection on our ZCard handout Map </td> <td><div align="center"> <input type="radio" name="choice2" value="150.00" onchange="checkTotal()" /> </div></td> </tr> <tr> <td bgcolor="#683B20"><div align="center"><span class="style6">Document Word Count</span> </div></td> <td colspan="2"> <div align="right"><br /> Word Count: <input name="num-words" type="text" size="30" /> </div></td></tr> </table> <div align="center"><br /> <input type="submit" name="Submit2" value="Generate Quote" /> </div> </form> Link to comment https://forums.phpfreaks.com/topic/50036-calculation-form-ugg/#findComment-246769 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.