473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

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

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...
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...
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...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.