[PHP] onchange read file, php & JS

2002-05-28 Thread Mihaela Dupret

Hy,

Is it possible to use a javascript variable into php or
to change it into php variable?

I have a list with the files from a directory, this works
fine. For the event onchange I want to show the content of
the file chosen.

So, in the code, the variable "inputf" has the file name
that I want to read. How can I use it in the code php?

Thanks a lot!

Mihaela



- Choisissez -



 




//JAVASCRIPT

function FileContenu(n){
 var inputf ="";

inputf=n.Types.options[n.Types.selectedIndex].value;

if(inputf=="choisir"){
n.mesg.value = "";

}

else{

ftp://$user:$pass@$server/home/$user/";;
$filehandle=fopen($file,"r");
if($filehandle){

while (!feof ($fp)) {
$buffer = fgets($fp, 4096);

}

fclose($filehandle);

?>

n.mesg.value = "";





}
}


//-->



__
Boîte aux lettres - Caramail - http://www.caramail.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] onchange read file, php & JS

2002-05-28 Thread 1LT John W. Holmes

You have to put the variable into a hidden form element or tack it onto a
URL in order to pass it to the PHP page.

---John Holmes...

- Original Message -
From: "Mihaela Dupret" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 6:51 AM
Subject: [PHP] onchange read file, php & JS


Hy,

Is it possible to use a javascript variable into php or
to change it into php variable?

I have a list with the files from a directory, this works
fine. For the event onchange I want to show the content of
the file chosen.

So, in the code, the variable "inputf" has the file name
that I want to read. How can I use it in the code php?

Thanks a lot!

Mihaela



- Choisissez -



 




//JAVASCRIPT

function FileContenu(n){
 var inputf ="";

inputf=n.Types.options[n.Types.selectedIndex].value;

if(inputf=="choisir"){
n.mesg.value = "";

}

else{

<?php

//conection ftp to read the file
$file="<A  HREF="ftp://$user:$pass@$server/home/$user/"">ftp://$user:$pass@$server/home/$user/"</A>;;
$filehandle=fopen($file,"r");
if($filehandle){

while (!feof ($fp)) {
$buffer = fgets($fp, 4096);

}

fclose($filehandle);

?>

n.mesg.value = "<?php echo $buffer;?>";





}
}


//-->



__
Boîte aux lettres - Caramail - http://www.caramail.com









> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php