Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a Submit Button using a picture

Posted on 2003-12-10
5
Medium Priority
?
410 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
[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
  • 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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 discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

719 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