Custom computer configuration script help

Hey guys.

Im working on adding a section to a clients web site where they can select upgradable options from a drop menu which will then update the price live.

Does anyone know how to do this? I need help. I can offer payment for someone who gets it working for me.

PHP/PERL/JAVASCRIPT preferred
 
Do you have the prices in a database? Or do you want them stored on the page/script then change in a dynamic way?

EDIT: I was thinking about this the wrong way, I was thinking about having two drop downs and one changing from the answer in the first.

Do you want to have various drop downs and maybe check boxes?
Eg. maybe drop downs for a level of management, and a check box for a dedicated IP.

Then the price will reflect what was selected on the other fields on the form?
 
I have them set in the value field.

Example :
<option value="1|PARTNUMBER=PRICE">Name of product ... $PRICE </option>

<option value="1|CPUCEL2800GHZ=20.54">Intel Celeron 2.8Ghz Processor ... $20.54 </option>

So basically I want the price in the value field to be added to the initial base price when this option is selected.

It is important that the part number stays in the value too. So when the form is submitted it will record what part to use.


If you think this would be easier with a db by all means let me know.
 
Ah ok well I think this might be more like I was thinking at first then.
Is there only one drop-down box used? Then the price of the selected item from the drop down menu will be shown in a box beside it?
That could be done easily without a db
 
I got this from a website, there is copyright so please take notice of it :)

Code:
<script LANGUAGE="JavaScript">

	//--------------------------------------------------
	// Copyright Reaz Hoque, 1996, All right reserved
	//web: [url]http://rhoque.com[/url]
	//email: [email]rhoque@rhoque.com[/email]
	// This code can be used for non-profit use only if
	// the copyright notice is kept.
	//---------------------------------------------------


var called=false;	//to make sure the function compute() is called
var T_Price=0;
var pr_flag;	//processor flag for keeping track of the choices
var pr_print="";

var sp_flag;	//flag for speed
var sp_print;

var ram_flag;	//flag for ram
var ram_print;

var hdrive_flag;	//flag for Hard Drive
var hdrive_print;

var vram_flag;	//flag for VRAM
var vram_print;

var fdrive_flag;	//flag for Floopy Drive
var fdrive_print;

var cd_flag;	//flag for CD Rom
var cd_print;

var mn_flag;	//flag for Monitor
var mn_print;

var mos_flag;	//flag for Mouse
var mos_print;

var kb_flag;	//flag for KeyBoard
var kb_print;

var modem_flag;	//flag for Modem
var modem_print;

var software_flag; //flag for software
var software_print;

var card_flag;        //flag for sound card
var card_print;

function compute(form){
called=true;

if (form.processor[0].selected){
	pr_print= "None [$0]";
	pr_flag=0;
}
	 
 if (form.processor[1].selected){
	pr_flag =540;
	pr_print="68LCO45 DD [$540]";
}

else if (form.processor[2].selected){
	pr_flag =340;
pr_print="68LCO45 EE [$340]";
}
	

else if (form.processor[3].selected){
	pr_flag =680;
	pr_print="68LCO45 FF [$680]";
}
	

else if (form.processor[4].selected){
	pr_flag =421;
	pr_print="68LCO45 GG [$421]";
}

//-------Speed----------
if (form.speed[0].selected){
	sp_flag=0;
	sp_print="None [$0]";
}

if (form.speed[1].selected){
	sp_flag=129;
sp_print="75 MHz [$129]";
}

if (form.speed[2].selected){
	sp_flag=180;
sp_print="100 MHz [$180]";
}

if (form.speed[3].selected){
	sp_flag=235;
sp_print="133 MHz [$235]";
}

if (form.speed[4].selected){
	sp_flag=250;
sp_print="166 MHz [$250]";
}

//-------RAM-----------
if (form.ram[0].selected){
	ram_flag=0;
	ram_print="None [$0]";
}

if (form.ram[1].selected){
	ram_flag=75;
ram_print="4 RAM [$75]";
}

if (form.ram[2].selected){
	ram_flag=120;
ram_print="8 RAM [$120]";
}

if (form.ram[3].selected){
	ram_flag=200;
ram_print="16 RAM [$200]";
}

if (form.ram[4].selected){
	ram_flag=350;
ram_print="32 RAM [$350]";
}

//-------Hard Drive-------
if (form.hdrive[0].selected){
	hdrive_flag=0;
hdrive_print="None [$0]";
}

if (form.hdrive[1].selected){
	hdrive_flag=100;
hdrive_print="250MB [$100]";
}

if (form.hdrive[2].selected){
	hdrive_flag=200;
hdrive_print="500MB [$200]";
}

if (form.hdrive[3].selected){
	hdrive_flag=300;
hdrive_print="750MB [$300]";
}

if (form.hdrive[4].selected){
	hdrive_flag=399;
	hdrive_print="1.0GB [$399]";
}


//-------VRAM-------

if (form.vram[0].selected){
	vram_flag=0;
	vram_print="None [$0]";
	}

if (form.vram[1].selected){
	vram_flag=50;
	vram_print="1MB DRAM [$50]";
	}

if (form.vram[2].selected){
	vram_flag=89;
	vram_print="4MB DRAM  [$89]";
	}

if (form.vram[3].selected){
	vram_flag=125;
	vram_print="8MB DRAM [$125]";
	}

if (form.vram[4].selected){
	vram_flag=200;
	vram_print="16MB DRAM [$200]";
	}

//-------Floppy-------
if (form.fdrive[0].selected){
	fdrive_flag=0;
	fdrive_print="None [$0]";
	}

if (form.fdrive[1].selected){
	fdrive_flag=75;
fdrive_print=" 1.4 ench. [$75]";
	}

if (form.fdrive[2].selected){
	fdrive_flag=50;
	fdrive_print="5.25 ench. [$50]";
	}

if (form.fdrive[3].selected){
	fdrive_flag=100;
	fdrive_print="BOTH [$100]";
	}

//-------CD ROM-------

if (form.cd[0].selected){
	cd_flag=0;
	cd_print="None [$0]";
	}
if (form.cd[1].selected){
	cd_flag=300;
	cd_print="600E Dual Speed [$300]";
	}

if (form.cd[2].selected){
	cd_flag=450;
	cd_print="800E Quadruple-Speed  [$450]";
	}
//----------Monitor-----------
if (form.monitor[0].selected){
	mn_flag=0;
	mn_print="None [$0]";
	}

if (form.monitor[1].selected){
	mn_flag=210;
	mn_print="12 ench. VGA [ $210]";
	}

if (form.monitor[2].selected){
	mn_flag=300;
	mn_print="14 ench. Super VGA [$300]";
	}

if (form.monitor[3].selected){
	mn_flag=290;
	mn_print="14 ench. VGA [$290]";
	}

if (form.monitor[4].selected){
	mn_flag=370;
	mn_print="14 ench. Super VGA [$370]";
	}

if (form.monitor[5].selected){
	mn_flag=350;
	mn_print="17 ench. VGA [$350]";
	}

if (form.monitor[6].selected){
	mn_flag=475;
	mn_print="17 ench. Super VGA [$475]";
	}

//-----------Mouse------
if (form.mouse[0].selected){
	mos_flag=0;
	mos_print="None [$0]";
}

if (form.mouse[1].selected){
	mos_flag=35;
	mos_print=" Vesa6 [$35]";
}

if (form.mouse[2].selected){
	mos_flag=120;
mos_print=" Titda9 [$120]";
}

//----------KeyBoard-----------

if (form.keyboard[0].selected){
	kb_flag=0;
	kb_print= "None [$0]";
}

if (form.keyboard[1].selected){
	kb_flag=75;
	kb_print="473E SPO [$75]";
}

if (form.keyboard[2].selected){
	kb_flag=120;
	kb_print="48dE SPO [$120]";
}

if (form.keyboard[3].selected){
	kb_flag=150;
	kb_print="874K SPO [$150]";
}

if (form.keyboard[4].selected){
	kb_flag=175;
	kb_print="888i SPO [$175]";
	}

//----------Modem-----------

if (form.modem[0].selected){
	modem_flag=0;
modem_print=" None [$0]";
}

if (form.modem[1].selected){
	modem_flag=100;
modem_print=" External 14.4 [$100]";
}

if (form.modem[2].selected){
	modem_flag=110;
modem_print=" Internal 14.4 [$110]";
}

if (form.modem[3].selected){
	modem_flag=150;
modem_print=" External 28.8 [$150]";
}

if (form.modem[4].selected){
	modem_flag=160;
modem_print=" Internal 28.8 [$160]";
	}

//----------Sound Card-----------
 
if (form.card[0].selected){
	card_flag=0;
card_print="None [$0]";
}

if (form.card[1].selected){
	card_flag=300;
card_print=" Adlib [$300]";
}

if (form.card[2].selected){
	card_flag=258;
card_print=" Sound Blaster [$258]";
}

if (form.card[3].selected){
	card_flag=235;
card_print=" Sound Blaster Pro  [$235]";
}

if (form.card[4].selected){
	card_flag=320;
card_print=" MIDI Mapper   [$320]";
}

T_Price=pr_flag+sp_flag+ram_flag+hdrive_flag+vram_flag+ fdrive_flag
+cd_flag+mn_flag+mos_flag+ kb_flag+modem_flag+card_flag;

form.T_Price.value="     $ "+ T_Price;


}
function print(form){
if(!called){
	compute(form);
}

text = ("<HEAD><TITLE>'UniVista On-line Computer Cost Esimator'</TITLE></HEAD>");
text = (text +"<BODY BGCOLOR =  '#FFFFFF' ><CENTER><B><FONT SIZE = 4><FONT COLOR=BLUE>UniVista On-line Computer Cost Esimator</FONT></FONT></B>");
text= (text +"<br><b>&copy Reaz Hoque, 1996<br></b></CENTER>");
text=(text+"<hr>");

text=(text+"<TABLE BORDER =0><TR VALIGN=Top><TD VALIGN=Top>");
text=(text+"<B>Processor:<BR>Speed: <BR>Monitor: <BR>Hardrive: <BR>Floppy Drive: <BR>Memory:");
text=(text+" <BR>VRAM: <BR>CD-ROM: <BR>Sound Card: <BR>Modem: <BR>Key Board: <BR>Mouse: ");
text=(text+"</B></TD><TD>")

text=(text+"<B>"+ pr_print+"<BR>"+sp_print+"<BR>"+ mn_print+"<BR>"+ hdrive_print+"<BR>");
text=(text+ fdrive_print+"<BR>"+ram_print+"<BR>"+ vram_print+"<BR>"+ cd_print+"<BR>");
text=(text+card_print+"<BR>"+ modem_print+"<BR>"+kb_print +"<BR>" +mos_print );
text=(text+"<TD></TR></TABLE><hr>");
text=(text+"<B><FONT COLOR=RED>Total Cost:</FONT>"+" &nbsp &nbsp &nbsp $"+T_Price);
text=(text+"<BR><BR><BR><BR><BR><FONT SIZE=-1><FONT COLOR=GREEN>To print, choose FILE and PRINT.</FONT></FONT>");
text=(text+"</body></html>");
                msgWindow=window.open("","displayWindow","toolbar=no,width=375,height=480,directories=no,status=yes,scrollbars=yes,resize=no,menubar=yes")
                msgWindow.document.write(text)
                msgWindow.document.close()
}




</SCRIPT><!-- styles for logos and headline links 
     do not modify internet, red, or black styles -->
 
<link REL="stylesheet" HREF="/css/text.css" TYPE="text/css">

<!-- no longer used --></head>

Include the code below on the same page.
 
Code:
<body bgcolor="#FFFFFF" text="#000000" link#0033FF vlink="#990099" alink="#FF0033" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<td align="left" VALIGN="TOP"><blockquote>
<form method=post>
<table CELLPADDING=8>
<tr><td>Processor:
<p><select NAME="processor">		 
<option Selected>	 Select                 
<option>        68LCO45 DD [$540]                 
<option>        68LCO45 EE   [$340]              

<option>        68LCO45 FF    [$680]             
<option>        68LCO45 GG   [$421]    
</select>
</td><td>Speed:  
<p>
<select NAME="speed">		 
<option Selected>	 Select                 
<option>        75 MHz      [$129]           
<option>        100 MHz     [$180]    
<option>        133 MHz  [$235]               
<option>        166 MHz  [$250]              

</select>
</td><td>Memory(RAM): 

<p>
<select NAME="ram">		 
<option>	 Select                 
<option>        4 RAM[$75]                 
<option>        8 RAM [$120]                
<option>        16 RAM [$200]                
<option>        32 RAM [$350]        
</select>
</td></tr><tr><td>Hard drive: 
<p>

<select NAME="hdrive">		 
<option>	 Select                 
<option>        250MB [$100]                
<option>        500MB  [$200]               
<option>        750MB  [$300]                
<option>        1.0GB    [$399]     
</select>
</td><td>VRAM: 
<p>
<select NAME="vram">		 
<option>	 Select                 

<option>        1MB DRAM  [$50]               
<option>        4MB DRAM   [$89]              
<option>        8MB DRAM    [$125]             
<option>        16MB DRAM   [$200]      
</select>
</td><td>Floppy Drive: 
<p>
<select NAME="fdrive">		
<option>	 Select                 
<option>        1.4MB [$75]                 
<option>        5.25MB [$50]                

<option>        BOTH    [$100]             
</select>
</td></tr><tr><td>CD-Rom: 
<p>
<select NAME="cd">		 
<option>	 Select                 
<option>        600E Dual Speed [$300]                
<option>        800E Quadruple-Speed  [$450]                        
</select>
</td><td>Monitor:
 
<p>
<select NAME="monitor">		 
<option Selected>	 Select                 

<option>        12" VGA   [ $210]             
<option>        12" Super VGA   [$300]              
<option>        14" VGA   [$290]              
<option>        14" Super VGA [$370]		 
<option>        17" VGA  [$350]               
<option>        17" Super VGA  [$475]     
</select>
</td><td>Mouse: 
<p>
<select NAME="mouse">		 
<option Selected>	 Select  

<option>	 Vesa6  [$35]           
<option>         Titda9    [$120]             
</select>
</td></tr><tr><td>KeyBoard: 
<p>
<select NAME="keyboard">		 
<option Selected>	 Select                 
<option>        473E SPO   [$75]             
<option>        48dE SPO   [$120]              
<option>        874K SPO   [$150]              
<option>        888i SPO      [$175]   

</select>
</td><td>Modem: 
<p>
<select NAME="modem">		 
<option Selected>	 Select                 
<option>        External 14.4 [$100]                 
<option>        Internal 14.4   [$110]              
<option>        External 28.8   [$150]              
<option>        Internal 28.8     [$160]    
</select>
</td><td>Sound Card: 
<p>

<select NAME="card">		 
<option>	 Select                 
<option>        Adlib   [$300]                
<option>        Sound Blaster    [$258]            
<option>        Sound Blaster Pro  [$235]              
<option>        MIDI Mapper   [$320]     
</select>
</td></tr></table>

<p> </p>
<table CELLPADDING="2">
<tr><td>

<input TYPE="BUTTON" NAME="Price" Value="Update Price" onClick="compute(this.form)"><br>
<input TYPE="text" SIZE=15 NAME="T_Price" value=""><br>
</td><td>
<input TYPE="BUTTON" NAME="Print_data" Value="Print Preview" onClick="print(this.form)">
</td></tr>
</table>
</form>
  </blockquote>

</td>

That is javascript although it does exactly what oyu need.
Just edit it for your needs :)
 
Top