|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php and vbscript interaction
hii there
I am planning to insert a particular php variable in an access database using adodb which i haev to use as part of a bigger application. this is test code which is not running. can anyone tell me how to correct this code. thanks <html> <body> <? $id=5; ?> </body> </html> <script language="VBScript"> dim conn dim rs dim connStr dim qry Set conn = createObject("ADODB.Connection") conn.CursorLocation = 3 set rs = createObject("adodb.recordset") conn.Open "Nihmonitor" qry = "Insert into q2(id) values (<? $id ?> )" conn.execute qry conn.close set rs = nothing set conn = nothing </script> Ravi |
|
#2
|
|||
|
|||
|
I don't think you can pass a variable like that between two different languages. I'm not exactly sure about VBScript but php is run on the server so when it sees your page with:
<html> <body> <? $id=5; ?> </body> </html> the actual output the browser sees would just be: <html> <body> </body> </html> unless you do something with the $id while still in php. You could try using a hidden element in a form like so: <input type="hidden" name="id" value="<?php echo $id; ?> Then read the that value with your VBScript. Your post is a little old so you could have figured this out a while ago, but if not I hope I helped. Ian |
|
#3
|
||||
|
||||
|
Well.. here's one thing that catches my eye. VBScript is not a serverside language by default. ASP is a serverside technology which can be implemented using VBScript, as well as C# and JavaScript. When you are running this page, there is nothing to tell the server that you are executing the code at the server - so the VBScript code should be sent to the client to run on their machine. If you want to create a ServerSide Script, then you need to add the "RunAt=Server" in your <Script> Tag, or just change the page to an ASP page. I agree with ravi, though. It is very difficult to pass variables to other languages. Most people I've heard of do it by assigning the calculated values to hidden text fields on the page... good luck... but I think I'd find some way to do it all in one language.
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > php and vbscript interaction |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|