troubleshooting Question

Javascript VAR Syntax

Avatar of Robert Granlund
Robert GranlundFlag for United States of America asked on
JavaScriptjQueryPHP
10 Comments1 Solution419 ViewsLast Modified:
I'm creating a Javascript var and I'm not sure I have all of the syntax correct.  Can you please have a look at the following and let me know what additional info you need to answer my question or let me know how to better right the following
<script>
	var myBox5 = document.getElementById('addon-28-custom-price[type-of-bicycle]').value;
		<?php
			$type_bike1 = $pdo->prepare($bike1);
			$elseif="";
			try {
			$type_bike1->execute();
			$type1 = $type_bike1->fetchAll();
			
			foreach ($type1 as $bt1)	{
					$bike_type1 = $bt1->type;
					$pd1 = $bt1->physical_damage;
					$bl1 = $bt1->bicycle_liability;
					$med1 = $bt1->medical_payment;
					$mtr1 = $bt1->motor_vehicle_contact;

					$elseif.="else if (myBox5 == '" . $bike_type1 . "') { myBox5a =" . $pd1 . ", myBox5alia =" . $bl1 . ", myBox5aMed =" . $med1 . ", myBox5aMtr =" . $mtr1 . "}";

			}
			echo substr($elseif,4)?>
			else {
				myBox5a = 1, myBox5alia = 1, myBox5aMed = 1, myBox5aMtr = 1  
			}
		<?php
			
		}
		catch(PDOException $b) {
   			echo 'ERROR: ' . $b->getMessage();
		}	
	?>
</script>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros