Solved

detect button name with input type image for submit button

Posted on 2010-08-27
4
520 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 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

Industry Leaders: 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!

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

690 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