Solved

use form image instead of submit button

Posted on 2006-11-10
2
227 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
[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
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.

690 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