Solved

detect button name with input type image for submit button

Posted on 2010-08-27
4
498 Views
Last Modified: 2013-12-13
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
Comment
Question by:prowebinteractiveinc
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Rajesh Dalmia earned 500 total points
ID: 33543936
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
 

Author Comment

by:prowebinteractiveinc
ID: 33546778
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
 
LVL 5

Expert Comment

by:wmadrid1
ID: 33547101
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
 

Author Closing Comment

by:prowebinteractiveinc
ID: 33659063
it works great thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now