lazerbrains Posted April 4, 2011 Share Posted April 4, 2011 I have a site that I have an about page with pictures of people on it. I would like to create something that would do the following: * When you click on one of the images, i need text for that image to load in a text area. I would like to do this rather than have to make a different HTML page for each person, but I am not sure how to go about doing it. I do not have a database for this site, so I will need to pull the text from a text file or something like that. Any ideas on how to get started would be helpful. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/232698-load-text-dynamically-depending-on-button-press/ Share on other sites More sharing options...
acefirefighter Posted April 5, 2011 Share Posted April 5, 2011 This isn't really a php question but more for JavaScript especially if you aren't wanting the page to reload all of the time. I use what is called jQuery and I have a few pages for you to look at and maybe you can sort out what you want to do. http://api.jquery.com/click/ http://api.jquery.com/show/ http://api.jquery.com/hide/ If you aren't wanting to use a database and aren't wanting to use files you can place all of your information that you want hidden in a div and "hide" it until a user "clicks" on the image and that would trigger the "show" if you were wanting to run from files I would look into jquery's post function but then you are getting into using an xml or json return which might just be overkill unless you have a ton of data. Look at the code on this page too. It is for a tabbed menu but the same concepts can be utilized and the code is easy to sort out. http://yensdesign.com/2008/12/create-a-smooth-tabbed-menu-in-jquery/ and here is one that explains what is happening in the jquery a little better and talks about jquery post http://www.jasonbrennan.com/jquery/jquery-ajax-or-is-it-jquery-json/ Sorry about the rambling. I hope this gets you started. I may be a little slow to respond but I will get back to you. Quote Link to comment https://forums.phpfreaks.com/topic/232698-load-text-dynamically-depending-on-button-press/#findComment-1196996 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.