Techno World Inc - The Best Technical Encyclopedia Online!

THE TECHNO CLUB [ TECHNOWORLDINC.COM ] => PHP => Topic started by: Hellraiser on August 29, 2007, 10:55:17 AM



Title: Integrate PHP with Javascript menus, alert box or
Post by: Hellraiser on August 29, 2007, 10:55:17 AM
Integrate PHP with Javascript menus, alert box or

This has been such a headache for me, working with javascript menus, alert boxes++ and dynamic data. Especially menus have given me a trip around the world. I kept compromising with my dynamic data and static menus, couldnt figure out what to do. I tried CSS menus on some of websites, they work fine but CSS menus are phew.. another headaches, stomach aches ++

And then one day there was a tiny ray of light in my dark tunnel of thoughts, I thought why don't I try and integrate static with dynamic ie PHP and javascript. The answer was so simple and easy to do that I couldn't believe I have been trying to do all those other things.

Yeh... so how do that....? Lets start with an example as usual.

Example

Lets consider you want to display today's date in an alert box for xyz reason.

Code:
<? $date=date('d-M-Y'); ?>
<script>alert("Date: <?echo $date?>");</script>

Note: If this example doesn't work check if PHP is installed on your webserver. Click here (http://technoworldinc.com/php_hypertext_preprocessor/install_and_configure_php5_on_windows_system-t24456.0.html) to install and test PHP on your local web server.