• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

detect button name with input type image for submit button

I have 2 forms on one page, a logon, and a register, both have a custom image submit button, how do I detect which button is clicked on in the php, so i could insert the info in the database ? I tried assigning a name to them and put isset($_POST['button_name']) but that doesnt appear to work
0
prowebinteractiveinc
Asked:
prowebinteractiveinc
  • 2
1 Solution
 
Rajesh DalmiaCommented:
as u have 2 separate forms then u can pass 2 diff hidden value and check that value in form submit....
like for login it can be

<input type="hidden" name="LogHid" value="LogHid">

and for register

<input type="hidden" name="LogRegister" value="LogRegister">

based on form submit u will get any one value...
0
 
prowebinteractiveincAuthor Commented:
i dont think that will work, because if I check the variable by isset, both will turn out active, and the form will try to process both forms
0
 
wmadrid1Commented:
If you have two forms, after submit, PHP jjust will receive the data from each form
<form name="form1" action="page.php">
<input type="hidden" name="LogHid" value="LogHid">
</form>

<form name="form2" action="page.php">
<input type="hidden" name="LogRegister" value="LogRegister">
</form>

If you submit form1so then
isset($_POST['LogHid']) will return true
and
isset($_POST['"LogRegister']) will return false
0
 
prowebinteractiveincAuthor Commented:
it works great thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now