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
<form name=showfile>
<SELECT NAME=Types onChange="javascript:FileContenu
(this.form)">
<OPTION SELECTED value="choisir">- Choisissez -
<?php
$conn_id = ftp_connect($server);
$login_result = ftp_login($conn_id, $user, $pass);
if ((!$conn_id) || (!$login_result)) {
echo "Connection problem! ";
die;
}
else {
$list=Array();
$list=@ftp_nlist($conn_id, "dirName");
$i=0;
do{
?>
<OPTION value="<?php echo $list[$i]; ?>">
<?php
echo $list[$i];
$i++;
}while($list[$i]);
}
?>
</SELECT>
</form>
//JAVASCRIPT
<script language="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="ftp://$user:$pass@$server/home/$user/????";
$filehandle=fopen($file,"r");
if($filehandle){
while (!feof ($fp)) {
$buffer = fgets($fp, 4096);
}
fclose($filehandle);
?>
n.mesg.value = "<?php echo $buffer;?>";
}
}
//-->
</script>
______________________________________________________
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