Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating quote form...

Status
Not open for further replies.

DGTLguy

Technical User
Jul 23, 2003
125
US
can you point me in the right direction?

i want to create a small form to embed in my existing webpage.
this form would return to the user a "service quote" by allowing them to select the various services which they would like us to complete for them.

for instance, if the form had 5 service options:

option#1 = $50
option#2= $100
option#3= $25
option#4= $10
option#5= $75

and the user clicked on option#2 & 4... then clicked submit... they would be returned an instant quote for "$110"...
 
And you want to do this in Javascript, client-side on the persons browser?

Or does your website have server-side capability ( CGI, ASP, PHP)?
 
i'm not exactly sure of the power of javascript or if this would be better handled some other way but any suggestions would be great...

i simply trying to stay away from flash due to many visitors not having it and in consideration of dialup users...
 
when the form submits:
<fom onsubmit="return calculate()">

<script>
function calcuate()
{
TheDropDown=document.forms[0].DROPDOWNNAME
Qoute=0
for(i=0;i<TheDropDown.length;i++)
{
if(TheDropDown.selected)
{
Qoute+=TheDropDown.value
}
}
document.forms[0].HIDDENFIELDNAME.value=Qoute
}
</script>


in ur PHP file:
<?=$_POST["HIDDENFIELDNAME"]?>


What is happening:
1. The calculate function adds up the selected items.
2. Stores it to a hidden field.
3. PHP reads the hidden field value (i am assuming that u u se post method of submission)...

Known is handfull, Unknown is worldfull
 
that looks like exactly what i was looking for... thank you... :)

and yes, i use the post method...

now its time to try and implement it
 
no problemmo...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top