Hi guys,
I've hit a wall again with this code and I'm sureit's something simple I'm doing wrong, I just can't see it.
<?php
include('php/head.php');
// form action
$asset=$_POST['asset'];
$item=$_POST['item'];
$link=sqlite_open('data/3002.sqlite ',0666,$sqliteerror);
sqlite_query($link,"INSERT INTO holding(item)
VALUES('$item')");
sqlite_query($link,"DELETE FROM '$asset' WHERE item= '$item'");
// open page display div
echo"<div class='image_pane'>";
// fetch data from db table
$link=sqlite_open('data/3002.sqlite ',0666,$sqliteerror);
$res=sqlite_query($link,"SELECT * FROM chest");
while($row=sqlite_fetch_array($res)){
$img=$row['item'];
// form with images as inputs
echo"
<form action='ins.php' method='post'>
<input type='hidden' name='asset' value='chest'>
<input type='hidden' name='item' value='".$img."'>
<input type='image' src='images/".$img.".png' border='0'>
</form>";
}
// close div
echo" </div>";
include('php/foot.php');
?>
The display part works fine, 5 images shown, the problem is in the form action script,
click on any image, and only the last in line is acted on. i.e the images are: food, torch, knife, scarf, key.
Click on food, and key is removed from the 'chest' table and inserted into 'holding'.
Whichever one is clicked, it's only the right hand one is dealt with.
Something simple...probably.