You are here: fireing function with onChange « PHP « IT news, forums, messages
fireing function with onChange

Posted by Aaron Todd on 02/10/05 18:06

I have a loop that is putting the filenames of files in a certain directory
into a listbox. I am then using the onChange event of the listbox to fire a
function. In this script the onchange event sends the function the path an
filename of the chosen file from the list. I have tested what I am sending
with a javascript alert and it looks ok. The funstion is supposed to open
the file and then make a new file(im working with jpegs using GD).

Unfortunately it isnt working the way I would want it to. Can soneone check
this code and see if there is anything wrong. In the browser it doesnt do
anything. I had hoped for at least an error code.

Hope someone can help...Thanks

<?php
function createimage($picpath){
$im = imagecreatefromjpeg($picpath);
imagejpeg($im,"images/temp.jpg");
}
$path = "images";
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "<select name='filelist' size='14' multiple
onchange=createimage('$path/'+this.options[this.selectedIndex].value)>\n";
while ($file = readdir($dir_handle))
{
if($file!="." && $file!=".."){
echo "<option value='$file'>$file</option><br/>\n";
}
}
echo "</select>\n";
echo "<img border='0' src='images/temp.jpg' width='300' height='224'>";
?>

 

Navigation:

[Reply to this 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

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