Jump to content

Archived

This topic is now archived and is closed to further replies.

leon

rollover image with php and mysql

Recommended Posts

Hello guys, I am new to php and mysql and i wanna use rollover images on my website. I created the codes for rollover image using dreamweaver but I can not estimate what do i need to do with mysql and php. Basically , I designed an html site using these images and tried to change the <img src> and rollover sections with the php codes but it was not useful. I hope it is clear. Can you help me?

Share this post


Link to post
Share on other sites
use php and mysql to generate the html for the page. use javascript for any 'interaction' that you want to do - such as roll overs.

document effects are client side matters while php and mysql deals with serverside things.

Share this post


Link to post
Share on other sites
your oviously very inexpiraneced with progrmaing, which is fine, thats why your hear asking questoins.

i am not sure what you are trying to do, you need to be more clear.

i think you want it that when you press the roll over button to goto a section on your site you want php and mysql to show that content when you press the button?

you will have to be more sepcific before anyone can offer any usefull advice.

Share this post


Link to post
Share on other sites
[!--quoteo(post=363028:date=Apr 9 2006, 01:00 PM:name=SomeGuy1337)--][div class=\'quotetop\']QUOTE(SomeGuy1337 @ Apr 9 2006, 01:00 PM) [snapback]363028[/snapback][/div][div class=\'quotemain\'][!--quotec--]
your oviously very inexpiraneced with progrmaing, which is fine, thats why your hear asking questoins.

i am not sure what you are trying to do, you need to be more clear.

i think you want it that when you press the roll over button to goto a section on your site you want php and mysql to show that content when you press the button?

you will have to be more sepcific before anyone can offer any usefull advice.
[/quote]
Technically it's scripting as opposed to programming. He wants to use a basic rollover; the image changes when you put the mouse on it. He wants to do so with PHP and MySQL, however, which isn't possible for the reasons explained by ToonMariner.

A rollover with Javascript is as simple as:

[code]<img src="pic.jpg" onmouseover="this.src='new.jpg';" onmouseout="this.src='pic.jpg';">[/code]

[Fixed the quotes.]

Share this post


Link to post
Share on other sites
[!--quoteo(post=363032:date=Apr 9 2006, 05:41 PM:name=Vorotaev)--][div class=\'quotetop\']QUOTE(Vorotaev @ Apr 9 2006, 05:41 PM) [snapback]363032[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Technically it's scripting as opposed to programming. He wants to use a basic rollover; the image changes when you put the mouse on it. He wants to do so with PHP and MySQL, however, which isn't possible for the reasons explained by ToonMariner.

A rollover with Javascript is as simple as:

[code]<img src="pic.jpg" onmouseover="this.src='new.jpg';" onmouseout="this.src='pic.jpg';">[/code]

[Fixed the quotes.]
[/quote]

Thanks for your replies. Actually i want to make my site dynamic with php and mysql, But i have problems with the rollover image.here is the address;

[a href=\"http://www.ionicstone.com/tiles.htm\" target=\"_blank\"]http://www.ionicstone.com/tiles.htm[/a]

Share this post


Link to post
Share on other sites
You can use PHP & MySql to build the javascript which is later run by the browser.

Ken

Share this post


Link to post
Share on other sites
OK, now I'm confused too as to what you want the rollover to do. If you want the full sized picture to appear on the left when the mouse is placed over the thumbnail, you'd use:

[code]// The full size image.
<img id="imgfull" src="tile1_full.jpg">

// A sample thumbnail.
<img src="tile2_thumb.jpg" onmouseover="imgfull.src='tile2_full.jpg';">[/code]
...as an example.

Share this post


Link to post
Share on other sites
Not wanting to re-invert your wheel but I am a great proponent of accessibility on websites...

Have you considered using css to do this? It means no javascript (so it doesn't matters if the visitor has js turned off) and you have an opportunity for visually imparied users to have their screen readers not have to deal with messy img tags!!!

take a look at www.regeneratingnb.co.uk and the associated css file (you will have to spend a bit of time if you are not familiar with class and id attributes and how to use them in css)

Share this post


Link to post
Share on other sites
[!--quoteo(post=363046:date=Apr 9 2006, 06:19 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Apr 9 2006, 06:19 PM) [snapback]363046[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Not wanting to re-invert your wheel but I am a great proponent of accessibility on websites...

Have you considered using css to do this? It means no javascript (so it doesn't matters if the visitor has js turned off) and you have an opportunity for visually imparied users to have their screen readers not have to deal with messy img tags!!!

take a look at www.regeneratingnb.co.uk and the associated css file (you will have to spend a bit of time if you are not familiar with class and id attributes and how to use them in css)
[/quote]

Thank you but, before css I need to learn php and mysql efficiently. I just thought it 'd be easier to use javascript for this because dreamweaver generates the code already, but because of my lack of knowledge, it turns into mess. I tried something like this but it doesnt help.By the way where to add script language='javascript' and </script> things while using php. ?

[code]<img src="<?php $data['image'] ?> onmouseover=<?php $data['image_roll']; ?>> alt="<?php echo $data['alt']; ?>" width="102" height="80" ....[/code]

Wow I liked this forum, everyone tries to help, I'm impressed.Thanks guys.

Share this post


Link to post
Share on other sites
i would [b]strongly[/b] advise you to conquer html+css before you move onto php

javascript is interpreted by the browser just as css and html is,
php is processed by the server.
any php code is only see by teh server and not the browser, which means its also secure.
javascript it used to dynamicly control the the page after its already been loaded.

dreamweaver shud be able to make you all teh rollover code and allow you just to specifiy which images to use.

Share this post


Link to post
Share on other sites
Yes, I think I will go for css rollover image. I realized that it only has a few line codes so that i can manage them efficiently. Thanks for your help. Let me search some examples for rollovers on the Net...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.