[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

detect button name with input type image for submit button

Posted on 2010-08-27
4
Medium Priority
?
532 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Rajesh Dalmia earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

650 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