![]() |
|
|
#1
|
|||
|
|||
|
Using Javascript and PHP
Hi everybody,
I want a value calculated in Javascript to be used in PHP b'coz that value will act as an argument for the function defined in PHP. Can I do it If yes, how? One thing I want to tell is that that function is to be defined in PHP only and not i Javascript. In short can I use a value calculated variable of Javascript in PHP. It is urgent... Need help. Thanx VJ |
|
#2
|
||||
|
||||
|
Not directly... JavaScript is client-side and PHP is server-side. The best you would be able to do is calculate whatever you want to calculate in JavaScript, then have the JavaScript trigger the loading of a page with that value within the URL (or a field in a form post) so PHP could evaluate it.
__________________
- Shawn Keyword Tracker now supports Google (once again) as well as Bing (new) and Yahoo Please do not PM, IM or email me for product or tool support (they will go unread/ignored), and don't "friend" me unless we are really friends. |
|
#3
|
||||
|
||||
|
Yes, the way Shawn just mentioned is about the only way to do it.
i.e. have the javascript do a window.location = 'file.php?varible=thevar' and have the PHP file use $_GET['varible'] to get it.. Josh
__________________
I'm Josh. And after a year and of half of absence, I'm back! join diggboss or invite link 2 |
|
#4
|
|||
|
|||
|
the problem now is that all the values i have calculated in Javascript have to be passed to a Payment gateway file and hence i dont think i wil be able to $_GET them.
any other alternative |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| JavaScript vs. PHP links | digitalpoint | PHP | 9 | Jan 23rd 2008 1:47 am |
| javascript, php accessing form elements | dave ner0tic | JavaScript | 4 | Dec 12th 2005 11:38 am |
| javascript, php | utrosa | JavaScript | 1 | Jan 18th 2005 1:29 am |
| Javascript or PHP World Clocks Coding? | misohoni | JavaScript | 8 | Sep 17th 2004 1:59 am |
| Help Needed on Converting specific javascript commands to php such as math.random() | ProductivePC | PHP | 4 | Jun 6th 2004 3:34 am |