PCHomepage
Programmer
I saw the postings here and elsewhere online about it but surely it can't be that difficult to have a form with two submit buttons of the same name and different values! However, I am very poor with arrays having just returned to PHP after years of disuse so can someone help? Because it is submitting to a third-party application, I can't really give the form buttons two different names. The form button images were originally like this:
but I could not seem to be able to fetch any values from either one so I revised them to this:
and viewing the raw output shows this:
and this for the other button:
and I am trying to fetch it and create variables with this but it is not getting through so any help would be greatly appreciated:
Code:
<input type="image" name="action" value="UpdateItem" src="button1.jpg">
<input type="image" name="action" value="ProcessOrder" src="button2.jpg">
but I could not seem to be able to fetch any values from either one so I revised them to this:
Code:
<input type="image" name="action[UpdateItem]" src="button1.jpg">
<input type="image" name="action[ProcessOrder]" src="button2.jpg">
and viewing the raw output shows this:
Code:
Array
(
[action] => Array
(
[UpdateItem] => 0
)
)
and this for the other button:
Code:
Array
(
[action] => Array
(
[ProcessOrder] => 0
)
)
and I am trying to fetch it and create variables with this but it is not getting through so any help would be greatly appreciated:
Code:
switch (array_keys($_POST['action'])) {
case 'AddItem':
$CartAction = "AddItem";
break;
case 'DeleteItem':
$CartAction = "DeleteItem";
break;
case 'UpdateItem':
$CartAction = "UpdateItem";
break;
case 'ProcessOrder':
$CartAction = "ProcessOrder";
break;
}