Solved

use form image instead of submit button

Posted on 2006-11-10
2
222 Views
Last Modified: 2006-11-18
Hello, I use image instead of submit form button and I tried to update user information, But it does not work. What I need to do to resolve this problem??

<?PHP
require_once('../log/dbini.php');
$conn=mysql_connect($DBSERVER,$DBUSER,$DBPWD);
$select_db=mysql_select_db($DBNAME,$conn);

$MYNAME=$_REQUEST['myname'];
$sql="UPDATE tbluser SET MYNAME='".$MYNAME."' WHERE USER1 = '".$_SESSION['USER1']."'";
$rst=mysql_query($sql);

?>

<form action="<?=$_REQUEST['PHP_SELF']?>" method="post">
<input type="text" name="myname">
<input type="image" name="update" value="update"  src="abc.jpg">
</form>
0
Comment
Question by:portal123
2 Comments
 
LVL 9

Accepted Solution

by:
tolgaong earned 400 total points
ID: 17918605
<form action="<?=$_REQUEST['PHP_SELF']?>" method="post">
<input type="text" name="myname">
<input type="submit" name="submit">
<img src="abc.jpg" onclick="document.forms[0].submit.click"> // you can check the form onsubmit event
<img src="abc.jpg" onclick="document.forms[0].submit()">     // you cannot check before the submit...
</form>
0
 
LVL 1

Assisted Solution

by:spdaniel91
spdaniel91 earned 100 total points
ID: 17921019
$MYNAME=$_REQUEST['myname'];
$_REQUEST['PHP_SELF']

NEVER ever use $_REQUEST. Because, imagine the form says the name is Nick, but the url is:

http://justexample.com/add.php?name=Dan

What one does it use? Sometimes one, sometimes another. Always use $_GET or $_POST.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

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…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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…
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

13 Experts available now in Live!

Get 1:1 Help Now