Forum Moderators: coopster
I have a page with next and previous buttons that loads a new image from a file in “url_path” into a table on the same page.
How do I make only the image refresh and not the entire page.
i found some info about an apparently elaborate file.php multifunction <div> method but i am wondering if there is anything less verbose since i'm only loading 1 new image per click.
//next button conditions
if($url_path_id!=$lastrow)
{ echo '<a href="popuptest.php?url_path_id='; echo $url_path_id+1; echo '&button=next">';
} //next button image
<img src="pseudo/moretest.png" width="200" height="100">
if($url_path_id!=$lastrow) echo '</a>'; //main image which I would like to reload without anything else reloading
<iframe img border="0" src="<? echo $row["url_path"];?>"width="400" height="400"></iframe> btw the <iframe> thing doesn’t do much aside from mess up my table, but someone said it would do the trick and well..here i am.
If there a specific place I should look for these types/caliber of questions please let me know.
Thanx much
I think this will do what you are trying to acheive:
<img src="pic1.jpg" width="#" height="#" name="photoslider" border="#">
<form method="POST" name="rotater">
<script language="javascript">
var photos=new Array()
var which=0photos[0]="pic1.jpg"
photos[1]="pic2.gif"
photos[2] ...
function previous(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which]
}
}
function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
}
else window.status='End of Pictures'
}
</script>
<input type="button" value="Back" name="B2" onClick="previous()">
<input type="button" value="Next" name="B1" onClick="forward()">
<a href="#" onClick="which=1;previous();return false">
Begin Menu</a>
</form>
-gs
I see the javascript, but I don’t see the php method.
I don't mean to be obtuse but how does this work towards getting the filepath from php and loading it. I have hundreds of image-paths in an array on the mysql_db (that I’m trying to access one at a time) kept in row[“url_path”]. I want to keep them on the server until individually called.
See my confusion?
the html/javascript only knows how many images there are.
all iamges are img1.jpg to img9999.jpg
you mod_rewrite the domain.tld/images/imgXXX.jpg to your php script, where you turn the number into the image path through the database and then pull the correct image and return it.
As far as the javascript is concerned all images are in teh same folder and numbered 1-XXX
alternatively of course you can skip the mod_rewrite bit and simply load some ugly old /cgi-bin/getimg.php/imgXXX.jpg
using path_info, or even more "retro" with the query string: /cgi-bin/getimg.php?img=XXX
hope that helps. if you want sample code, sticky me with your exact requrements... mind you I haven't done PHP, in my scripting language it'll be peanuts, and PHP is more powerfull...
SN
The file path to the images are on the mysql db, kept in array row[url_path ], where url_path is some /folder/image1.jpg…whew.
I see your methods but I think your addressing more problems and solutions than I am ready to handle.
I think the part of the problem may be that when I click on my “call next image” button the url path in the status bar of the browser changes from say
http:.. /Test/popuptest.php?url_path_id=8&button=next
to
http:.. /Test/popuptest.php?url_path_id=9&button=next
and so calls a whole new page when i click the not so fuzzy but fussy mouse.
-aquamon1