Picture help

I can’t figure out how to make the images show up on the web page. I am very new to the coding scene.

		<title>Car Search</title>
		<select name="cars" id="cars">
			<option value="Select a Car">Select a Car</option>
		<button id="search-car-btn">Click to Search!</button>

			<h3 id="car-name"></h3>
			<h3 id="car-color"></h3>
			<h2 id="car-price"></h2>
		<img src="" id="car-image" alt="car" width="400" height="400"><br/>

		var carID=[0,1,2,3,4];

		var names=[

		var colors=[
			"Navy Blue",
			"Lollipop Green",
			"Sunset Yellow",
			"Blood Red"

		var price=[
			"200,000 Dollars",
			"40,000 Dollars",
			"10,000 Dollars",
			"25,000 Dollars",
			"150,000 Dollars"
		var images=[

		var selection=document.getElementById("cars");
		//populate the dropdown dynamically
		for (var i = 0; i < names.length; i++) {
			var option=document.createElement("option");

			var select=document.getElementById("cars");
			var option=select.options[select.selectedIndex];

			var id=option.getAttribute("id");


Hi, chjrusse. Welcome to the forums.

The code that you have posted includes php calls; therefore, the HTML is invalid (one should frequently test the validity of HTML during development here: https://validator.w3.org/nu/) and we are unable to render those calls as content. Please post the code after it has been interpreted by your browser so we will have something to work with. You can do that by opening the page in your browser and showing/viewing the page source, then copying that page source to a new file which you will then include in your next post in this thread or you can include a link to your test server so we can access the test page directly.

If you have not read our posting guidelines, please take a few minutes and do so.


1 Like

I don’t see any PHP there, it looks like javascript to me and likely more a question for the javascript forum.

Though you are right about the need to validate the html.

Moved to javascript


Re: the php, somehow I mixed two posts. Thanks for catching that. .

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.