Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

use form image instead of submit button

Posted on 2006-11-10
2
Medium Priority
?
229 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 1600 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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 i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

618 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