Hi, I am a PHP/CSS/HTML developer currently working on an IT Project Management Application.I am developing a web app that would allow the company receive project requests from the various clients.The PHP development i am ok,its the incorporation of Javascript function to allow calculation of an individual projects cost when a user selects a certain level and certain quantity.


Sorry for the typo, what i meant is "I would really appreciate your help since i have googled and bing on this and i haven't found a solid solution"

a)The help i require is the html form has the Portfolio No.I would like when the user selects a number, it automatically picks the default function in the script i.e get_price (default return Portfolio No * 1).

b)When the use selects one of the Levels i.e Level 1, 2 or 3, it will automatically pick the correct function i.e Level 1, function get_price, Level 2, function get_price2 and Level 3, function get_price3.

When (a) and (b) are selected the results are displayed in the text box "per_project"

c)When the user "Selects NO of Projects",the script will calculate the value in per_project and Select No of Project.

d)The total will be displayed in the textbox Total Cost of Project.


I hope i have explained what i would want help with.If you need further clarification, kindly inform me.


Below is the HTML code and at the bottom is the script for price. I have added explanations within the code to show how each field should be interacting with the other.


I would really appreciate you help since i have googled and bing on this and i haven't found a solid solution.

All your help will be highly appreciated.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>testpage:</title>
  


</head>

<body>

<!-- Form  Code Start -->
<form id='form' action='test.php' method='post' accept-charset='UTF-8'>
<fieldset >
<legend>Post Project</legend>

<div class='short_explanation'>* required fields</div>

<div class='container'>
    <label for='title' >Title*: </label><input type='text' name='title' id='title' 
	maxlength="50" /><br/>
   

<!-- I would like when a user selects this field (Portfolio No), the javascript function will check all levels of get_price i.e get_price, get_price2, get_price3
-->
<div class='container'>
    <label for='length' >Portfoli No*:</label>
		<select name="length"  id='length' >
<option value="Select Portfolio No">Select</option>
<option value="1" >1 </option>
<option value="2" >2 </option>
<option value="3" >3</option>
<option value="4" >4 </option>


</select>
    
</div>
<!-- I would like when a user selects one of the radio buttons, it will select the correct getprice function.This should be combined with the Portfolio No.
For level 1 when checked, should pick the correct value from the function get_prce.This should also be combined with the Portfolio No selected.
For level 2 when checked, should pick the correct value from the function get_price2.This should also be combined with the Portfolio No selected.
For level 3 when checked, should pick the correct value from the function get_price3.This should also be combined with the Portfolio No selected.

The values from the getprice functions should be displayed in the textbox per_project
-->
<div class='container'>
    <label for='level' >Level*:</label><br/>
	<input type="radio" name="level" value="Level1" >Level - 1<br>
<input type="radio" name="level" value="Level2" >Level - 2<br>
<input type="radio" name="level" value="Level3" >Level - 3
   
</div>

<!-- I would like when a user selects one of the values, it should generate the right number of textboxes
-->

<div class='container'>
    <label for='no_of_projects' >Select No of Projects*:</label>
		<select name="no_of_articles" id='no_of_articles'>
<option value="Select Number of Words">Select</option>
<option value="1" selected >1 </option>
<option value="2" >2 </option>
<option value="3" >3 </option>
<option value="4" >4 </option>
<option value="5" >5 </option>
<option value="6" >6 </option>
<option value="7" >7 </option>
<option value="8" >8 </option>
<option value="9" >9 </option>
<option value="10" >10 </option>
<option value="11" >11 </option>
<option value="12" >12 </option>
<option value="13" >13 </option>
<option value="14" >14 </option>
<option value="15" >15 </option>
<option value="16" >16 </option>
<option value="17" >17 </option>
<option value="18" >18 </option>
<option value="19" >19 </option>
<option value="20" >20 </option>
</select>
    
</div>

<div class='container'>
    <label for='subtitles' >Insert subtitles in the boxes*:</label><br/>
    
</div>
<tr id="textboxDiv"></tr>

<!-- This field below should display the combination of getprice and selected Portfolio No values i.e if Portfolio No is 1 and level is 1 then value to be displayed is 1.75
-->

<div class='container'>
    <label for='per_project' >Price<span id ='value_box_title'>per</span> project*:</label><br/>
    <input type='text' name='per_project' id='per_project' readonly  /><span id='cost_label1'>(minimum $ <span id='cost_labl1'></span>per project)</span><br/>
   
</div>

<!-- The field below should display the value in the per_project field to be multiplied by the value selected in no_of_projects
-->

<div class='container'>
    <label for='totalcost' >Total Project Cost*:</label><br/>
    <input type='text' name='totalcost' id='totalcost'  maxlength="50" readonly /><span id = 
	'cost-label2'>($<span id='cost_label2'></span> per article</span><br/>
    
</div>
<div class='container'>
    <input type='submit' name='Submit' value='Submit' />
</div>

<!-- The javascript can have a function that will display a message to the user informing them that a project has been created successfully and they have 
1 day to check back.
-->

</fieldset>
</form>


<!--
Form Code End
-->

<!-- Below are the getprice functions that will form the basis of calculations
get_price should be active when level 1 is selected and Portfolio No selected.Value should be displayed in the per_project field.

get_price2 should be active when level 2 is selected and Portfolio No selected.Value should be displayed in the per_project field.

get_price3 should be active when level 3 is selected and Portfolio No selected.Value should be displayed in the per_project field.
-->

<script type='text/javascript'>


function get_price(Portfolio No)

{
	switch(parseInt(Portfolio No))
		{
		case 1: return 1; break;
		case 3: return 2; break;
		case 4: return 3; break;

		default: return Portfolio No * 1;
		}
		
		}
		
function get_price2(Portfolio No)
{
    switch (parseInt(Portfolio No))
    {
        case 1: return 1; break;
        case 3: return 2; break;
        case 4: return 3; break;

        default: return Portfolio No * 0.01;
    }
}

function get_price3(Portfolio No)
{
    switch (parseInt(Portfolio No))
    {
        case 1: return 1; break;
        case 3: return 2; break;
        case 4: return 3; break;

        default: return Portfolio No * 0.01;
    }
}
		
</script>
</body>
</html>