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

This is a discussion on Com object with PHP How to use? Here is the code within the PHP Language forums, part of the PHP Programming Forums category; I've this code: <?php $coi = new COM("Coi4ImplP.Coi4"); $empresas = $coi->Inicio("C:\Archivos ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2007
JAYO
 
Posts: n/a
Default 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.

Reply With Quote
  #2 (permalink)  
Old 01-19-2007
VK
 
Posts: n/a
Default Re: Com object with PHP How to use? Here is the code

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.

Reply With Quote
  #3 (permalink)  
Old 01-22-2007
Vince Morgan
 
Posts: n/a
Default Re: Com object with PHP How to use? Here is the code


> <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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:47 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0