| | |
Pass Javascript variable to PHP code
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2007
Posts: 15
Reputation:
Solved Threads: 0
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??
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??
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
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.
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.
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['time.from.js'];
Of course though, Ajax is best sollution for your problem.
Last edited by Rhyan; Feb 16th, 2007 at 5:08 am. Reason: url gets shortened when displayed
•
•
Join Date: Apr 2007
Posts: 11
Reputation:
Solved Threads: 1
Last edited by stymiee; Sep 12th, 2007 at 11:16 am. Reason: email addess removed
![]() |
Similar Threads
- Problem with javascript variable and hidden input (ASP.NET)
- javascript variable in jsp session (JSP)
- Passing a Javascript variable to a PHP using <script> call (JavaScript / DHTML / AJAX)
- How Can I Pass A PHP Variable From One .php page to another (PHP)
Other Threads in the PHP Forum
- Previous Thread: Need Help Please!
- Next Thread: Using the Next And Previous Buttion
| Thread Tools | Search this Thread |
.htaccess advanced ajax apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display download dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert integration ip java javascript job joomla limit link login loop mail menu mlm mod_rewrite multiple mysql oop password paypal pdf php problem query radio random recursion regex remote script search server sessions smarty sms soap source space sql stored syntax system table traffic tutorial unicode update upload url validation validator variable video web xml youtube






