PHP/MySQL - Load More Data on Click

Posted on 2010-01-05
Medium Priority
Last Modified: 2013-12-13

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.
Question by:davidcairns90
  • 2
  • 2

Expert Comment

ID: 26179927
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.

Author Comment

ID: 26179964

i have very limited knowledge of javascript. is it possible to elaborate on this

Accepted Solution

xBellox earned 2000 total points
ID: 26179983
It would be something like this:

<script type="text/javascript">
function showOthers() {
	var myDiv = document.getElementById('others');
	myDiv.style.visibility = 'visible';
	myDiv.style.display = '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


Author Closing Comment

ID: 31672855
Thank you. worked like a dream

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question