Hi guys,
I have a script that does different tasks depending on which button they press on a form.
I set the buttons on the form as follows
<td align=\"left\">
<form action=\"$_SERVER[PHP_SELF]\" method=\"post\">
<input type=\"hidden\" name=\"VideoToDelete\" value=\" $row[0] \"/>
<input type=\"submit\" name=\"button\" id=\"delete\" value=\"delete\"/>
</form>
</td>
<td align=\"left\">
<form action=\"$_SERVER[PHP_SELF]\" method=\"post\">
<input type=\"hidden\" name=\"VideoToEdit\" value=\" $row[0] \"/>
<input type=\"submit\" name=\"button\" id=\"edit\" value=\"edit\"/>
</form>
</td>
I've used a hidden element which holds the value of the video I want to perform an action on, e.g. edit, or delete and a submit element called button with a value of edit or delete which I then use in a swtich in a script as follows:
switch (@$_POST['button']) {
case "edit":
// edit code
break;
case "delete":
// delete code
break;
That seems to be working fine. Now I want to use one of the columns in my table that holds a small thumb nail (image) as a button. I was hoping the same approach would work. I set the thumbnail image up as follows:
<td align=\"left\">
<form action=\"$_SERVER[PHP_SELF]\" method=\"post\">
<input type=\"hidden\" name=\"thumbToUpload\" value=\" $row[0] \"/>
<input type=\"image\" src=\"$Thumb\" height=\"30\" width=\"40\" border=\"0\" name=\"button\" value=\"submit\" />
</form>
</td>
and added a new value to the switches
switch (@$_POST['button']) {
case "edit":
// edit code
break;
case "delete":
// delete code
break;
case "submit":
// submit code
break;
but it doesn't. Any tips would be very welcome.
Tim.