Reply to Re: Com object with PHP How to use?

Your name:

Reply:


Posted by Steve on 01/19/07 04:02

"JAYO" <jayo999@gmail.com> wrote in message
news:1169170682.904272.35290@m58g2000cwm.googlegroups.com...

Steve ha escrito:

> "JAYO" <jayo999@gmail.com> wrote in message
> news:1169161230.507761.303490@38g2000cwa.googlegroups.com...
> |I have a COM Server that create an object with PHP, then from the html
> | input sentence using onchange, goes to a javascript function, as
> | parameter the input value, within this value i want to get from the COM
> | Server an answer. From PHP the object is created with new, as:
> | $coi = new COM("Coi4ImplP.Coi4");
> | and I can get from the server the answer as:
> | $hresult=$coi->Empresa($_POST["empresa"]);
> | $ruta=$coi->Ruta();
> | $niveles=$coi->Niveles();
> | $nombree=$coi->Nombre();
> | but in the input area from the html page in the from like:
>
> i can't understand your english. just do this:
>
> $coi = new COM("Coi4ImplP.Coi4");
> print '<pre>\n';
> print_r($coi);
> print '</pre>\n';
>
> then post the output back here.

Thank you very much for your help.
The code. Some functions and it works ok:
<?php
$coi = new COM("Coi4ImplP.Coi4");
$empresas = $coi->Inicio("C:\Archivos de programa\ASPEL\ASPEL-COI
4.0");
$hresult=$coi->Empresa("2");

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

print '<pre>\n';
print_r($coi);
print '</pre>\n';

?>

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.
18/01/2007
\ncom Object

\n

My problem is in the html, the code: (i can't get $coi->Ruta answer in
the rdes function)

ok...here's the original:

function rdes(cta){

var <?php $k=$coi->Ruta; echo('$k='.$k); ?>;
alert($k);
desc="DESCRIPCION";
for (var n1 = 0; n1 <= 15; n1++)
{
if((document.getElementsByName('cuenta[' + n1 + ']')[0].value) == cta){
document.getElementsByName('desc[' + n1 + ']')[0].value = $k;
}
}
}

and i bet all you get is an empty message box...right? you are expecting:
'C:\Coi\Fycampo\HUGO\Datos\' ... yes? depending on the value of $k, you
should be getting javascript errors before the alert even fires.

view your html output right now. you should be able to see something like:

var C:\Coi\Fycampo\HUGO\Datos\ = C:\Coi\Fycampo\HUGO\Datos\;

here's a hint, PHP executes on the SERVER...javascript executes on the
CLIENT. that means all of your references in that function to $k are going
to have to either be:

<?= $k ?>

or

<? echo $k; ?>

or

<?php echo $k; ?>

$k is only a variable while it is on the server. by the time it gets to your
browser, $k will be a literal value and will not change. this is because PHP
outputs the value of $k before the html gets to the browser.

so, maybe think of trying:

function rdes(cta)
{
var k = <?php $k = $coi->Ruta; echo $k; ?>;
alert(k);
desc = "DESCRIPCION";
for (var n1 = 0; n1 <= 15; n1++)
{
if(document.getElementsByName('cuenta[' + n1 + ']')[0].value == cta)
{
document.getElementsByName('desc[' + n1 + ']')[0].value = k;
}
}
}

see if that helps.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация