473,473 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Com object with PHP How to use? Here is the code

I've this code:

<?php
$coi = new COM("Coi4ImplP.Coi4");
$empresas = $coi->Inicio("C:\Archivos de programa\ASPEL\ASPEL-COI
4.0");
$hresult=$coi->Empresa("2");
$ruta=$coi->Ruta;
echo "$coi->Ruta<br>";
echo "$coi->Niveles<br>";
echo "$coi->Nombre<br>";
echo "$coi->Tipos<br>";
echo "$coi->Version<br>";
echo date("d/m/Y");//date("Y-m-d");
echo "\n";
echo "$ruta<br>";

print '<pre>\n';
print_r($coi);
print '</pre>\n';
function rcuenta($vale){
echo "hola".$vale;
echo "<br>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Otro ejemplo relacionando variables php</title>
</head>

<body>

<?php echo "$coi->Ruta<br>"; ?>
<?php echo "rcuenta(\"HOLA\")<br>"; ?>
<?php rcuenta("OTRO"); ?>
<?php echo "<br>"; ?>
<input type="text" name="ruta" size="10" value="<?php echo
$ruta;?>">
<input type="button" value="REGISTRA" name="Registra"
onclick="limpia()"><br />

<script language="javascript" type="text/javascript">
function limpia(){
alert($ruta);

}
</script>
</body>

</html>

The output:

C:\Coi\Fycampo\HUGO\Datos\
4 3 3 3
FYCAMPO S.A DE C.V
Dr Ig Eg
SERVIDOR COIW4, VERSION 1.0 PARA FYCAMPO, S.A. DE C.V.
19/01/2007 C:\Coi\Fycampo\HUGO\Datos\

\ncom Object

\n C:\Coi\Fycampo\HUGO\Datos\
rcuenta("HOLA")
holaOTRO
in the input box is the variable $ruta, that's OK, but when I press the
button 'REGISTRA' the page gets an error.
How can I get in a javascript function a Com variable like this?
Thank you in advance.

Jan 19 '07 #1
2 1149
VK
JAYO wrote:
I've this code:
<snip>

These are PHP server-side processing instructions, they are irrelevant
to the problem (if this is a JavaScript and not a PHP problem).
Following these instructions PHP processor creates ready-to-use HTML
source text and sends it to browser for parsing and display. I need
_that_ HTML source text in order to help you. The most simple way would
be to open the problematic page in any browser, choose View Page
Source (or equivalent), copy all and paste it in your next post. Then
we can move further.

Jan 19 '07 #2
<input type="text" name="ruta" size="10" value="<?php echo
$ruta;?>">
<input type="button" value="REGISTRA" name="Registra"
onclick="limpia()"><br />

<script language="javascript" type="text/javascript">
function limpia(){
alert($ruta);

}
</script>
</body>

</html>
What you are passing to the "limpia()" function is a string, nothing more.
Whatever meaning it may have on your server is lost on the client machine as
it knows nothing about what you trying to do. If it were the actual name of
a COM object you know should exist on the client machines then you would
first need to create an instance of that object at the client end before you
do anything with it.
I.e.
var obj = new (the $ruta string);

HTH
Vince Morgan
Jan 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
2
by: Aaron | last post by:
I have a data sructure setup and I populate it in a loop like so: y=0 while X: DS.name = "ASDF" DS.ID = 1234 list = DS; y = y + 1
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
6
by: Clark Sann | last post by:
Can someone help me understand what object should be used as the lock object? I've seen some programs that use Monitor.Enter(Me). Then, in those same programs, they sometimes use another object. ...
5
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: ...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.