Jump to content

Recommended Posts

First, I am trying to figure out the best way to organize this.

 

http://bli.servehttp.com/bli/knowledgebase/calculator.php#functions

 

I have a list of dropdown boxes, and 3 arrays that control what values will be in the dropdown.

 

Array 1 is the list of values for each dropdown box.

Array 2 is the list of values you would program into the engine (a decimal value) (this has a 1:1 relation ship with Array 1)

Array 3 is the list of default values programmed into the engine from the factory, so the correct selection of the dropdown will be displayed when the page is loaded.

 

So basically

When the page loads, it calls a php function that iterates through all 28 functions, and creates a new table row and dropdown each time.

 

Now what I need the script to do is realize which cv it is creating and select it in the dropdown box...

 

I hope that makes sense.

 

Here is the code so far:

 

function createDropdown() {
$functionName  = Array("Nothing", "Front/Rear Lights", "Bell Sound", "Horn Sound", "Couple/Uncouple Sound", "Compressor/Grid Blower Sound", "Diesel Ramp Up", "Disel Ramp Down/Start Diesel Sound", "L1 Function", "Mute/Volume Control", "Startup/Shutdown Sounds", "Cooling Fan Sound", "Air Fill/Air Release Sound", "Brake Set/Release/Squeal Sound", "Fuel Fill Sound", "Spit Valve Sound", "Wheel Flange Sound", "Coupler Slack Sound", "Brake Squeal Sound", "Horn2 Toggle", "Horn Grade Crossing Sound", "Play Macro", "Record Macro", "Passenger Sounds", "Freight Sounds", "Maintenance Sounds", "Radio Chatter", "City Sounds", "Farm Sounds", "Industrial Sounds", "Lumber Yard Sounds");
$functionValue = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ,12 ,13, 14, 15, 16, 17, 18, 19, 30, 40, 41, 50, 51, 52, 53, 54, 55, 56, 57);
$defaultValues = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 30, 50, 51, 52, 53, 54, 55, 56, 57, 19, 0, 0, 0, 40, 41, 18);

for ($i=33; $i<=61; $i++) {
	$func = $i-33;

	$row = "<tr class='isOdd'><td>$func</td><td><select name='func".$func."' />";

	$n=0;

	foreach ($functionName as $fN) {
		$row .= "<option value='$functionValue[$n]'>$fN</option>";

		$n++;			
	}

	$row .= "</select></td><td>$i</td><td><input type='text' size='8' name='funcValue$i' /></td></tr>";

	echo $row;


}

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.