Hello, this may not be the correct forum but I'll start here. I have a system that retrieves information from a database. I want to have some of that information hidden until a user checks a box to display it.

The script is here:

<script type="text/javascript" language="JavaScript">
			function HidePart(d) { document.getElementById(d).style.display = "none";  }
			function ShowPart(d) { document.getElementById(d).style.display = "block"; }
			function CheckboxChecked(b,d)
			{
			   if(b) { ShowPart(d); }
			   else  { HidePart(d); }
			}
			</script>

I am placing it into a PHP page pulling the information from the database.

It displays fine, except no matter which record you click the box under, it expands the first record only. I have the following code within a php "for each" script.

<input type="checkbox" name="mycheckbox" value="yes"  onclick="CheckboxChecked(this.checked,'checkboxdiv')">Check this box to view more details.
								<div id="checkboxdiv" style="display:none">

Any ideas?

Thanks

the problem is your argument, you send the same div id for each checkbox, you have to send the associated div id.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.