2 Submit Button as a Image help

I am unable to see what submit button is checked.

I have 2 submit buttons one is Update and the other is addnew.

<input name="UpdateInfo" id="UpdateInfo" type="image" src="arrowforlink2.gif" style="position:absolute; left:341px; top:34px; z-index:3; width:21px; height:19px;">

<input name="AddNew" type="image" src="arrowforlink2.gif" style="position:absolute; left:342px; top:235px; width:21px; height:19px; z-index:4">

Now here is the problem when I hit either of the submit buttons when i try to see which one isset it does not work.  I use a GET to see what vars i was passing and in the query string it gives me
UpdateInfo.x=5&UpdateInfo.y=15   And the same with add new AddNew.x=10&AddNew.y=10

The if(isset($_Get["UpdateInfo"])) does not work.  I even tried it if(isset($_Get["UpdateInfo.X"]))

I take it it is putting the .x and .y because I am using CSS.

Does anyone have any suggestion on how I can determine which submit button has been pressed?

Thanks



//full script code
<?session_start();header("Cache-control: private");

if(isset($_Get["UpdateInfo"]))
{
echo "HI";}else{
$Email = $_SESSION['emailAddress'];
$cID = $_SESSION['uID'];
if($ExistingAddress){
//echo $ExistingAddress;
mysql_connect
("sqlc1.megasqlservers.com","dbm.kargarian.com", "nicole");
@mysql_select_db("TechNo_kargarian_com") or die("Unable to select database");

$result=mysql_query("select * from Bill where BillID = $ExistingAddress");

while($row=mysql_fetch_array($result))
{
$billID = $row['BillID'];
$LoginID = $row['LoginID'];
$FLName =$row['FLName'];
$StreetAddress = $row['StreetAddress'];
$Apt = $row['Apt'];
$Prov = $row['Prov'];
$City = $row['City'];
$Zip = $row['Zip'];
$Country = $row['Country'];
$Phone = $row['Phone'];
$useAS = $row['useAs'];
}

}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="Style/UpdatenewDeliveryIE.css" rel="stylesheet" type="text/css">

<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<form name="updateBilling" method="GET" action="UpdatenewBilling.php">
<body background="Account%20Login/NEWUpdateNewBilling(800x600.gif">

<div id="Layer1" style="position:absolute; left:293px; top:35px; width:49px; height:16px; z-index:1"><font size="2" face="tahoma"><strong>Update</strong></font>
</div>

<div id="Layer2" style="position:absolute; left:284px; top:235px; width:64px; height:18px; z-index:2"><font size="2" face="tahoma"><strong>
Add New</strong></font> </div>

<input name="UpdateInfo" id="UpdateInfo" type="image" src="arrowforlink2.gif" style="position:absolute; left:341px; top:34px; z-index:3; width:21px; height:19px;">
 
    <select name="ExistingAddress" class="ExAddress" onChange="document.updateBilling.submit()">
<Option>Select Address</Option>
    <?
mysql_connect
("sqlc1.megasqlservers.com","dbm.kargarian.com", "nicole");
@mysql_select_db("TechNo_kargarian_com") or die("Unable to select database");

$result=mysql_query("select BillID, FLName, StreetAddress, Apt, Prov,Phone, City, Zip, Country, useAs from Bill where LoginID = $cID");

while($row=mysql_fetch_array($result))
{//start of while
$billID = $row['BillID'];
$useAS = $row['useAs'];
$StreetAddy = $row['StreetAddress'];

  if($useAS == "AddUseAsBilling"){
?>
<option value="<?echo $billID;?>">
<?PHP echo $StreetAddy;?>
</option>
<?        
     }
}//end of while

?>  
    </select>
  <div class="Billing">
    <input type="radio" name="UseAs" value="rdoUseAsBilling">
  </div>
  <div class="Delivery">
    <input type="radio" name="UseAs" value="rdoUseAsDelivery">
  </div>
  <div class="Both">
    <input type="radio" name="UseAs" value="UseBoth">
  </div>
  <div class="FirstName">
<input type="text" name="txtFLName" class="FirstName" align="texttop"
value="<?echo $FLName;?>">
     </div>
  <p><select name="optCountry" class="Country" >
      <option value="<?echo $Country;?>"><?echo $Country;?></option>
    </select>
    </p>
  <div class="myStreetAddress">
<input type="text" name="txtStreetAddress" class="myStreetAddress" align="texttop" value="<?echo $StreetAddy;?>">
   </div>

<div class="myStateProv">
<input type="text" name="txtStateProv" align="top"  class="myStreetAddress" value="<?echo $Prov?>" >
</div>
  <div class="myApt">
    <input type="text" name="txtApt" class="myApt" value="<?echo $Apt;?>">
  </div>  
  <div class="myCityTown">
    <input type="text" name="txtCityTown" class="myApt" value="<?echo $City;?>">
  </div>
<div class="myPostalCode">
<input type="text" name="txtPostalCode" class="myPostal" style="width:110px" value="<?echo $Zip;?>">
</div>
<input type="radio" name="AddUseAs" value="AddUseAsBilling" class="AddBilling">
<input type="radio" name="AddUseAs" value="AddUseAsDelivery" class="AddDelivery">
<input type="radio" name="AddUseAs" value="AddUseAsBoth" class="AddBoth">
<div class="myContactPhone">
<input type="text" name="txtContactPhone" class="myContactPhone" value="<?echo $Phone;?>">
</div>
<input name="AddNew" type="image" src="arrowforlink2.gif" style="position:absolute; left:342px; top:235px; width:21px; height:19px; z-index:4">
  </form>
</body>
</html>
<?}?>

LVL 1
Codeit1978Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Diablo84Commented:
Try with

if(isset($_Get["UpdateInfo_X"]))
0
 
Diablo84Commented:
Note: for debugging purposes add print_r($_POST); or print_r($_GET); in your case to see what the post and get arrays contain. You can then observe the array keys to see the value you should be checking for.
0
 
Diablo84Commented:
Note2: In Firefox/Mozilla if(isset($_Get["UpdateInfo"])) should work however in IE the value of the image is not posted (and subsequently there is no key for the elements name). This has just caused me a major headache... as IE has done on many occasions.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
RoonaanCommented:
As alternative to Diablo's suggestion you could use javascript:

Change:
<input name="AddNew" type="image" src="arrowforlink2.gif" style="position:absolute; left:342px; top:235px; width:21px; height:19px; z-index:4">

into
<input type="hidden" name="submitbutton" value="" />
<input name="AddNew" type="image" src="arrowforlink2.gif" style="position:absolute; left:342px; top:235px; width:21px; height:19px; z-index:4" onclick="this.form.submitbutton.value=this.name" />

Then you could use if($_GET['submitbutton'] == 'AddNew') instead of issets.

This doesn't work on browsers which don't support javascript obviously.

Regards

-r-

<observation>Diable84, are you trying to set some kind of posting record here? </observation>
0
 
Diablo84Commented:
:)

A case of delayed after thought followed by a delayed delayed after though.
0
 
Codeit1978Author Commented:
I did the print r command and got:

[UpdateInfo_x] => 5 [UpdateInfo_y] => 17

When I did if(isset($_Get["UpdateInfo_y"])) or if(isset($_Get["UpdateInfo_x"])) it did not work.

I just may have to go with javascript.  Any other suggestions?
0
 
Diablo84Commented:
hmm, just tested with:

<?php
if (isset($_GET['UpdateInfo_x'])) echo "UpdateInfo Clicked";
if (isset($_GET['AddNew_x'])) echo "AddNew Clicked";
?>
<form action="/a.php" method="get">
<input name="UpdateInfo" id="UpdateInfo" type="image" src="arrowforlink2.gif" style="position:absolute; left:341px; top:34px; z-index:3; width:21px; height:19px;">
<input name="AddNew" type="image" src="arrowforlink2.gif" style="position:absolute; left:342px; top:235px; width:21px; height:19px; z-index:4">
</form>

works fine in IE and Firefox
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Diablo84Commented:
You could also try with:

if (array_key_exists("UpdateInfo_x",$_GET))

instead of

if(isset($_Get["UpdateInfo_x"]))

but the latter should work fine
0
 
Codeit1978Author Commented:
Diablo84,  Thanks I think I may have got it to work.

let me play with it for a sec to make sure it is working corretly,  it will work using a post aswell correct?
0
 
Diablo84Commented:
>> it will work using a post aswell correct?

yes, post and get are both essentially arrays so the same principles apply to both in this case.
0
 
RoonaanCommented:
strpos(strtolower(implode('',array_keys($_GET))), 'updateinfo')

and

strpos(strtolower(implode('',array_keys($_GET))), 'addnew') could work also :)

-r-
0
 
hernst42Commented:
Just a note:
The Problem with your code is that the superglobal $_Get does not exists. It's $_GET, so if you change the variable $_Get to uppercase it should work.

If you don't want to care about how the form was subitted by post or get you can use $_REQUEST which combines the $_GET, $_POST, $_COOKIE to one array.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.