Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-15-2012, 11:05 PM   PM User | #1
bigcasey123
New Coder

 
Join Date: Feb 2012
Posts: 95
Thanks: 1
Thanked 5 Times in 4 Posts
bigcasey123 is an unknown quantity at this point
Need help please.

I have a drop menu and i want a image to change when a option is chosen form it. It's a search engine website and people can choose from the drop menu if they want to use "google search" or other ones. When they choose one from the drop menu then i want the image on top of the search box to change to the logo of the search engine they chose. Can this be done with php or do i need javascript? I already downloaded the logos so now i just need them to change when a option is chosen.
bigcasey123 is offline   Reply With Quote
Old 09-16-2012, 07:24 AM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Quote:
Originally Posted by bigcasey123 View Post
I have a drop menu and i want a image to change when a option is chosen form it.

Can this be done with php or do i need javascript? I already downloaded the logos so now i just need them to change when a option is chosen.


To answer your original question concisely: you'll have to use Javascript no matter how small as you'll need it to capture the drop-down event.

You can use a combination of PHP and Javascript by using AJAX to load the images using a back-end PHP script when needed - that is if you don't want the page to refresh inorder to load a new search-engine service. Then also use Javascript to change the search-engine URL target.

You can also use Javascript alone but you'll have to pre-load a lot of the involved stuff like Images to the browser which may take more time than just using AJAX to load them. Although you can just load maybe the most used search engine first then after the DOM is ready and the user can interact with the site, proceed to load the images and other needed stuff to the cache in the background.

I think using a combination of Javascript -AJAX - PHP is the best. It will make initial page load faster.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk

Last edited by Redcoder; 09-16-2012 at 07:33 AM..
Redcoder is offline   Reply With Quote
Old 09-16-2012, 09:45 AM   PM User | #3
Webpeak
Banned

 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Webpeak is an unknown quantity at this point
is the best method a combination of js and php?
Webpeak is offline   Reply With Quote
Old 09-16-2012, 09:52 AM   PM User | #4
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Quote:
Originally Posted by Webpeak View Post
is the best method a combination of js and php?
Personally...I prefer the combination of JAVASCRIPT and PHP using AJAX to load the needed files like images because it's easier and faster to apply to the web application architecture. Also the app perfomance is good and there are no page refreshes needed as the needed stuff is loaded in the background.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:22 AM.


Advertisement
Log in to turn off these ads.