Solved

detect button name with input type image for submit button

Posted on 2010-08-27
4
496 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
it works great thanks
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
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…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 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

17 Experts available now in Live!

Get 1:1 Help Now