delickate Posted May 15, 2008 Share Posted May 15, 2008 hi, i've 3 image in same page. image A,B,C from database. i would like to swap these 3 images in click.i've images on page like. A B C A on center B on left side C on right side if i click on B it goes to A's place and A must positioned on B and atructure should be like B A C then if i clike on C then B & C should swap like C A B i dont need click on center image.just click on left or right image and they swap.can any one do fever me plz? Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/ Share on other sites More sharing options...
RichardRotterdam Posted May 15, 2008 Share Posted May 15, 2008 I think javascript would probably be more effective with php you will need a refresh everytime you swap a certain image. but if it is php since you are probably trying to order your gallery. I would add a position field for each image in your database. then each image on your php page you put in a hyperlink <a href="update_image_position.php?image_id=1"><image src="image.png" /></a> and on the update_image_position.php page you do a mysql update query and the redirect back to your gallery page Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541684 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 HERE YOU GO IT ALL DYNAMIC MATE........... try this for a lath tell me what you think mate! javascript sucks use php html xhtml css ....................... <?php $a=" <table align='center' border='0'><tr> <td> <table align='center' border='0'><tr> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=a'> <img width='20px' src='http://www.vendian.org/howbig/UnstableURLs/letter_a.gif'/> </a> </td> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=b'> <img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-B.jpg' /> </a> </tr></td> </table> <table align='center' border='0'><tr> <tr> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=c'> <img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-C.jpg' /> </a> </tr></td></table> </tr></td></table> "; ?> <?php if($_GET['cmd']==a){ echo $a; exit; } ?> <?php $b=" <table align='center' border='0'><tr> <td> <table align='center' border='0'><tr> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=b'> <img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-B.jpg' /> </a> </td> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=c'> <img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-C.jpg' /> </a> </tr></td> </table> <table align='center' border='0'><tr> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=a'> <img width='20px' src='http://www.vendian.org/howbig/UnstableURLs/letter_a.gif'/> </a> </tr></td></table> </tr></td></table> "; ?> <?php if($_GET['cmd']==b){ echo $b; exit; } ?> <?php echo" <table align='center' border='0'><tr> <td> <table align='center' border='0'><tr> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=c'> <img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-C.jpg' /> </a> </td> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=a'> <img width='20px' src='http://www.vendian.org/howbig/UnstableURLs/letter_a.gif'/> </a> </tr></td> </table> <table align='center' border='0'><tr> <td> <a href='".$_SEVER['PHP_SELF']."?cmd=b'> <img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-B.jpg' /> </b> </tr></td></table> </tr></td></table> "; ?> <?php if($_GET['cmd']==c){ echo $c; exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541713 Share on other sites More sharing options...
Daniel0 Posted May 15, 2008 Share Posted May 15, 2008 javascript sucks Care to elaborate on that? Why? Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541749 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 HERE GOES WHY REDARROW THINKS JAVASCRIPT SUCKS.......... I design a grate looking web site selling apples,I get it on the very top off all search engines, i really really spend 100 of hours geting loads off traffic........... A user comes to my web site wanting to order 10.000 pound worth off apples but he couldnt becouse he refuse to have javascript enabled on his browser....... i lost 10 ground ........ EXSPLAINED..... so is javascript really any good not for me anyway... javascript is client side so users have the abilty to turn it on or off from there browser... Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541759 Share on other sites More sharing options...
Daniel0 Posted May 15, 2008 Share Posted May 15, 2008 No offense, but the programmer's incompetence is not a shortcoming of the language. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541829 Share on other sites More sharing options...
delickate Posted May 15, 2008 Author Share Posted May 15, 2008 thanx alot redarrow. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541845 Share on other sites More sharing options...
947740 Posted May 15, 2008 Share Posted May 15, 2008 This is irelleavant, but I must say that was quite the burn... Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541848 Share on other sites More sharing options...
Daniel0 Posted May 15, 2008 Share Posted May 15, 2008 This is irelleavant, but I must say that was quite the burn... I suppose you're referring to me. For someone who claims to have nine years of experience with Javascript and 20 years of experience with creating websites (source) it shouldn't be too hard to overcome the "problem" redarrow explained. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541858 Share on other sites More sharing options...
947740 Posted May 15, 2008 Share Posted May 15, 2008 Yes, I was referring to you, Daniel0. Even the fact that he has been building websites longer than the web itself without knowing HTML... Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541960 Share on other sites More sharing options...
redarrow Posted May 15, 2008 Share Posted May 15, 2008 There is no way that anybody can tell me that javascript is crap... users can turn javascript off... It all hipe javascript/ajax it all clint controlled sorry everyone but i dont think javasript means anythink to anyone sorry.... Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541975 Share on other sites More sharing options...
947740 Posted May 15, 2008 Share Posted May 15, 2008 Let us vote on whether or not javascript is "crap": CLICKY Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-541989 Share on other sites More sharing options...
GingerRobot Posted May 17, 2008 Share Posted May 17, 2008 Someone was going to spend £10,000 on apples?! Thats going to be one hell of a pie! Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-543639 Share on other sites More sharing options...
redarrow Posted May 18, 2008 Share Posted May 18, 2008 ((dan)) I also read the comment you said about my profile, because ive done 20 years in seo you assume i haven’t because off seo wasn’t around or html well the term seo and html wasn’t your correct sorry, But i was creating bbs for Commodore 64 in machine code via telephone lines back in 1995..... Dan you don’t need to be nasty to me, or put me down, just because i don’t like JavaScript do ya? I agree with you on the post you posted about javascript and the links you provided, but i just think that JavaScript Ajax is a way to get web page's just look flash...... The only reason i think personally JavaScript is crap, is that many clients Ive ever had in the pass all complain that there users refuse to turn JavaScript on, not because the way the JavaScript was coded or implemented just because users didn’t want to turn JavaScript on full stop.. I also have worked with macromedia flash products and programming concepts, that was also another big problem where users didn’t want to download the plug-in, even Theo i tried my best to stop lagging with the macromedia server's didn’t go down to well.... I am sorry if i have touch a sore point in saying that JavaScript is crap, don’t mean to offend the hard scripting communities in JavaScript or java server communities it the way i fill. If all browser's didn’t have the ability to turn JavaScript off then ill fell so happy to continue to use JavaScript and use all the funky interactive functions the language provides but until then ill have to stick with css, html. Sorry mate but when you into days world go to the jobs offering good well paid programming positions they always ask about JavaScript Ajax and it really pees me off because off the come backs with complaints relating to users not wanting to have JavaScript enabled and it always the programmer/designer who get the boot in the nuts via the boss... I have also noticed that still today, that good old html and css simple looking web sites still win the day with business clients with not one complaint... sorry if ive have offended you in anyway........ Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-543945 Share on other sites More sharing options...
corbin Posted May 18, 2008 Share Posted May 18, 2008 From an extremely technical and nitpicky point of view, HTML and CSS can both be disabled as well. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-543969 Share on other sites More sharing options...
Daniel0 Posted May 18, 2008 Share Posted May 18, 2008 I'm sorry that I offended you. I still believe that you have that opinion because you lack the sufficient knowledge about the subject. I was, and am, trying to give you part of that knowledge. At the end of the day, what this site is essentially about is learning. I don't know if you use or have used Gmail, but if you try to compare the responsiveness and overall experience I'm certain you'd be much more pleased to use the Javascript version than using the basic HTML version. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-544011 Share on other sites More sharing options...
xnowandtheworldx Posted May 18, 2008 Share Posted May 18, 2008 Enough debating? Well, Delickate I would look into using AJAX in order to do this. You could use PHP but as mentioned, you must also refresh the page to see the image moved. With AJAX you can do this without refreshing the page, unfortunately I don't know any AJAX. But I hope I pointed you in the right direction a little bit. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-544014 Share on other sites More sharing options...
GingerRobot Posted May 18, 2008 Share Posted May 18, 2008 I don't know if you use or have used Gmail, but if you try to compare the responsiveness and overall experience I'm certain you'd be much more pleased to use the Javascript version than using the basic HTML version. Or even just here on these boards - the quick option to reply and the quick modify buttons are much nicer than having a whole new page reload. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-544026 Share on other sites More sharing options...
947740 Posted May 19, 2008 Share Posted May 19, 2008 Or even just here on these boards - the quick option to reply and the quick modify buttons are much nicer than having a whole new page reload. I definitely agree with that. Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-544794 Share on other sites More sharing options...
redarrow Posted May 20, 2008 Share Posted May 20, 2008 Ok dan, thank you for the links ill read them so the time you have gave on the subject off javascript is not lost chers mate.......... redarrow.... [sOLVED] Quote Link to comment https://forums.phpfreaks.com/topic/105724-help-in-swaping-images-plz/#findComment-545815 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.