Hello..
I am designing a page in which if i click "call" button the button gets disabled and the timer starts.. This code is in JavaScript..(coz I couldn't write the PHP code to start timer on a button click)

Now.. I need to pass the time of the "call" button click to the DataBase along the other fields of the database...

How this is done??

The only possible way to do this with PHP and Javascript is to have the javascript to refresh the page, best way is with a hidden form, than have PHP detect the form submition and than execute the script to add info to the database.

Ajax as mentioned before is another option.

PHP is a server side script and is processed by the server, the client browser never sees the PHP. Javascript is processed by the client browser. Therefor javascript cannot call PHP functions.

The only possible way to do this with PHP and Javascript is to have the javascript to refresh the page, best way is with a hidden form, than have PHP detect the form submition and than execute the script to add info to the database.

The other way is to use GET method to call the php script, where the start time value is passed as a get variable.

e.g. yoursite/php_script_name.php?start_time=time.from.js

This should be captured on the other side by the php with $_GET;

Of course though, Ajax is best sollution for your problem.

hi MeeraKotecha
can u tell me how can i use timer in my webpages i am making one pages in which i need timer function in this pages

regards
wavalker

Hello..
Thank u all.. This problem is solved using the hiddden variables..

Depends what do you need the timer for - just to reload a page, or for something else. Just google javascript timer and you will get tons of scripts.

Good luck

thank u Rhyan
one thing more i am not able to call open dialog box in php to upload image if u have any idea plz help me........
.........

can u please tell me how can i use timer in my webpages i am making one pages in which i need timer function in this pages and what is ajax mean and its uses

This article has been dead for over six months. Start a new discussion instead.