problem with script =/
Posted: Sun Aug 28, 2005 5:53 am
Hi can anyone tell me whats wrong with this script:
Basically i would like an image to change based on the value of an input box... i would also like the value of the input box to remain the same as the person input into it...rather than resetting itself. Also if there was a way for this code to be loaded based on a change in value of the input box that would be good too ^_^
Any help on this matter is greatly appreciated.... spent ages searching to no avail
Thanks ^^
feyd | Please use
Code: Select all
<?php
if (isset($_POST['item'])) {
if ($_POST['itemnum'] > "") {
$itemnum = $_POST['itemnum'];
$image_dir = 'images/Soma/Items';
$itemnum = $itemnum;
if(!is_dir($image_dir))
{
echo ('Sorry but that is not a Direcotry.');
exit;
}
if(($dir_open = opendir($image_dir)) == false)
{
echo ('Error-- Could not open Directory');
exit;
}
while(($read_dir = readdir($dir_open)) != false)
{
if(!preg_match('/^\.+$/',$read_dir))
{
if(preg_match('/gif|jpeg|jpg|ico|png$/', $read_dir))
{
$images[] = $read_dir;
}
}
}
echo "<img src=\"images/soma/items/$images[$itemnum]\">";
}
}
?>Any help on this matter is greatly appreciated.... spent ages searching to no avail
Thanks ^^
feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]