PHP/MySQL - Load More Data on Click


i have a table in my db that contains text and 5 images. on the page load i only want the text and one image to be displayed. then when the image is clicked on the remaining four images are displayed with the original content. i have pulled the  text and image. I dont know how to go about loading the rest of the images on click.

Any advice would be helpful.
Who is Participating?
It would be something like this:

<script type="text/javascript">
function showOthers() {
	var myDiv = document.getElementById('others'); = 'visible'; = 'block';

<div id="first">
My 1st text and image... <img src='teste.gif' onClick='showOthers()'>
<div id="others" style="visibility: hidden; display: none;">
My 2nd text and image... <img src='test2.gif'><br><br>
My 3rd text and image... <img src='test2.gif'><br><br>
My 4th text and image... <img src='test2.gif'><br><br>
My 5th text and image... <img src='test2.gif'><br><br>

Open in new window

I think if it's only 5 images, that the best way to do this is using javascript and css.

You hide the others 4 text and images and at the event onClick of your 1st image you show the rest.
davidcairns90Author Commented:

i have very limited knowledge of javascript. is it possible to elaborate on this
davidcairns90Author Commented:
Thank you. worked like a dream
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.