Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - PHP and Javascript | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Dragato Goomba Level: 9 Posts: 20/25 EXP: 3053 For next: 109 Since: 03-15-04 From: England Since last post: 517 days Last activity: 339 days |
| ||
Is it possible to use Javascript and PHP together, for the list of affiliates on my site I use javascript to show the sites 88x31 when you hover over the link. But now that I've made an affiliate application feature which stores them all in the MySQL database I need it to list all of the affilates that have been acceted, obviously using PHP. So would it be possible to keep the javascript, or is there a PHP function which would do the trick? Javascript by the way: image0=new Image image1=new Image image0.src=http://rpg-ascension.aerocore.net/images/8831b.gif image1.src=http://hg.aerocore.net/images/8831c.gif a href=http://hg.aerocore.net onMouseOver=document.imagename02.src=image1.src onMouseOut=document.imagename02.src=image0.src target=_blank |
|||
Rydain Ropa Blaze Phoenix Runs With the Dragon Within Level: 42 Posts: 111/738 EXP: 490056 For next: 31306 Since: 03-15-04 From: State College, PA Since last post: 6 days Last activity: 8 hours |
| ||
Both languages have different purposes. JavaScript is a client-side language interpreted by the browser. PHP is a server-side language - a web server parses PHP files to create HTML, which it displays to the person viewing your site. JS is perfect for the mouseovers you described, but pulling data out of MySQL requires a server-side language like PHP (because the server can see the database, but - assuming proper security on your web server - a random person viewing the page can't). You can certainly use both at once - just have the PHP script that generates a page spit out the necessary JavaScript, or save the JavaScript to an external file and make sure that you link to it in the head of the generated page. | |||
Tuvai Permanently banned for account hacking. Level: 24 Posts: 191/211 EXP: 74894 For next: 3231 Since: 03-15-04 Since last post: 566 days Last activity: 339 days |
| ||
You output Javascript the same way in PHP as you output HTML. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - PHP and Javascript | | | |