Solved

Creating a Submit Button using a picture

Posted on 2003-12-10
5
408 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
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.

751 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