Try this:
<title>Test</title>
<body>
<form name='form1' method="post" >
<input type=hidden name="btn" >
<a href="#" onclick="btn.value='amex';submit();return false;">
<img src="../amex.gif" name="btn" border="0" alt="Amex"></a>
<a href="#" onclick="btn.value='visa';submit();return false;">
<img src="../visa.gif" name="btn" border="0" alt="Visa"></a>
</form>
<?
{
if (isset($HTTP_POST_VARS['btn']))
echo "<br>Button : ". $HTTP_POST_VARS['btn'];
else
echo "<br>Button Not set";
}
?>
</body>
Arnie from Canada wrote:
I cannot get my image-based "submit" buttons to, "set!" What on earth am I doing wrong? This looks perfect on paper, but none of them get "set," for any subsequent "isset" testing I want to do!
<form name='form1' method="post" action="self.php">
<input type="image" src='image1.jpg' name="type_1">
<input type="image" src='image2.jpg' name="type_2">
<?php
if(isset($type_1))
{
echo "form was submitted with image button 1.";
}
else
{
if(isset($type_2))
{
echo "form was submitted with image button 2.";
}
else
{
echo "form was not submitted with any image button.";
}
}
?>
</form>