Re: fireing function with onChange

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aaron Todd wrote:
> 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'>";
> ?>

In honor of our recent Super Bowl, here is a slow-motion instant replay:

Bob: "Well, it's a great day so far for PHP today, isn't it Jim?"
Jim: "You've got that right, Bob!  Now let's check out this play."
Bob: "Watch as the user surfs right to that web page!"
Jim: "Yeah, smooth!"
Bob: "Then, Apache detects the .php in the URL and hands off the action to
PHP!"
Jim: "PHP has been really strong today, hasn't it?"
Bob: "Sure has, Jim!"
Jim: "Then, PHP builds up some HTML and JavaScript and sends it out!"
Bob: "Yeah, and then PHP says 'Job Done.'"
Jim: "You've got that right, Bob! PHP is outta the game for now, resting."
Bob: "Now watch carefully as the user interacts with the browser."
Jim: "Pay particular attention as they change items in the filelist box."
Bob: "Oooooh! What a fumble!!!"
Jim: "Yeah, it's definitely much too late to be handing off to PHP!"
Bob: "Sure is, Jim. PHP has been out of the game now for awhile!"

Copyright Richard Lynch and the NFL.
Unauthorized re-broadcast is a violation of Federal Law.

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux