Solved

Creating a Submit Button using a picture

Posted on 2003-12-10
5
403 Views
Last Modified: 2007-12-19
Does anybody have a simple script to create a Form Submit button using a picture. Thanks,
0
Comment
Question by:Zambian4eva
  • 3
5 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 9916066
you can use JavaScript and put the picture in a link:

<a href="javascript:void(document.myform.submit())"><img src="source_here"></a>
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 9916089
or you can do this:

<INPUT TYPE="image" NAME="submit" src="source_here" alt="Submit">
0
 

Author Comment

by:Zambian4eva
ID: 9916173
I tried the

<INPUT TYPE="image" NAME="submit" src="source_here" alt="Submit">

however my form action =$PHP_SELF

and then this is after

if($submit)
{
call function
}

It will submit however it will not pass the "name" so that the if statement becomes true.

0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 9916257
You can get around that by adding a hidden element, like <input type="hidden" name="beenSubmitted" value="submitted"> and changing your if statement to if ($beenSubmitted == "submitted")

You might have to use $_REQUEST['beenSubmitted'] depending on how you have global variables set.
0
 
LVL 11

Accepted Solution

by:
shmert earned 125 total points
ID: 9916805
When you use an image as a submit button, PHP passes the X and Y coordinates in the $_POST args.  So, to see if the form was submitted using a given images, you should check:

if (isset($_REQUEST['submit_x'])) {
    // call function
}
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

760 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

21 Experts available now in Live!

Get 1:1 Help Now