Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 02-18-2009, 09:48 AM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
Lightbulb <input type="image" src="login_button.png" name="login" /> Error in IE !! HELP

<input type="image" src="login_button.png" name="login" /> this will show up as NOT set in IE, but SET in Chrome. It will only show SET in IE, if i change type into type="submit" rather than "image".

These two piece of codes is from my website. I put them on test.php and test_action.php in attempt to figure out the problem.

test.php:

<form action="test_action.php" method="post">
<input type="image" src="direct_images/header_login_button.png" name="login" />
</form>

In test_action.php the only thing is:

if (isset($_POST['login'])) {
echo "login is set";
} else {
echo "error";
}


Yet, it says "login is set" for chrome, but says "error" in IE. However, if i change the type="image" into type="submit", it works fine in both.

I'm sure you'd get the same result if you try it on your wamp.

any comment is apprecaited.!!
 
Reply With Quote

Advertisement

Advertisement

  #2 (permalink)  
Old 02-18-2009, 10:50 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
The problem is that when it posts, an image submit does not send over it's name with the post, only the x and y coordinates with which the mouse clicked the image on.

Chrome, I think is actually incorrect in regards to standards when doing this, that is why it is working for you. You should not be testing your site on Chrome, but IE and FF since they are the major browsers.

You will see this does not work in IE or FF.

What I suggest you do is instead of looking for $_POST["login"], look for either the ["x"] or the ["y"] variables, which insures that it was submitted. (Make sure they are greater than 0 for the values though just in case and for security.)
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
 
Reply With Quote
  #3 (permalink)  
Old 02-18-2009, 04:03 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
Exclamation

Quote:
Originally Posted by Izzmo View Post
The problem is that when it posts, an image submit does not send over it's name with the post, only the x and y coordinates with which the mouse clicked the image on.

Chrome, I think is actually incorrect in regards to standards when doing this, that is why it is working for you. You should not be testing your site on Chrome, but IE and FF since they are the major browsers.

You will see this does not work in IE or FF.

What I suggest you do is instead of looking for $_POST["login"], look for either the ["x"] or the ["y"] variables, which insures that it was submitted. (Make sure they are greater than 0 for the values though just in case and for security.)
integrating x and y variables into my script seems too complex. Is there another way of replacing the submit button with an image without breaking the code?
 
Reply With Quote
  #4 (permalink)  
Old 02-18-2009, 05:10 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
What do you mean too complex? It's simple: Instead of looking for $_POST["submit"], just look for $_POST["x"].
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
 
Reply With Quote
  #5 (permalink)  
Old 02-19-2009, 04:53 AM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
but does the x and y value change as the browser window or font size change?
 
Reply With Quote
  #6 (permalink)  
Old 02-19-2009, 07:45 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
No, it changes based on where you clicked the image at.

But you should not care about the value, only the value itself is presented in the POST.
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
 
Reply With Quote
  #7 (permalink)  
Old 02-19-2009, 04:49 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
Could you write me the full $ _POST statement?
 
Reply With Quote
  #8 (permalink)  
Old 02-19-2009, 07:07 PM
Izzmo's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
So it would be

Code:
if(isset($_POST["x"]) && $_POST["x"] > 0) { // Do something.. }
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
 
Reply With Quote
  #9 (permalink)  
Old 02-19-2009, 07:57 PM
Contributing Member
Latest Blog:
None

 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
Exclamation

Quote:
Originally Posted by Izzmo View Post
So it would be

Code:
if(isset($_POST["x"]) && $_POST["x"] > 0) { // Do something.. }
For the second $_POST do u mean "y" instead of x?

Also, what kind of stuff could interfere with this?
I mean how would the $_POST x and y knows what input field its descrbing?
 
Reply With Quote
  #10 (permalink)  
Old 02-20-2009, 09:43 AM
Izzmo's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
No, I mean x. It makes sure x is set and if it is, then it makes sure the coordinates are greater than 0 (because you can't click on something less than 1,1).

There would only be one field for these. Unless of course you had a field x or a field why, or both as an input; but you as the developer should not do this since you know you are using a image submit.

With that, x and y could only be the submit button because you can only hit a single submit on any POST and because the x and y variables are listed last.

So, that means it would be describing the submit image.

On my example, you could use either x or y, it doesn't matter since they will always be there. I just used x because it is the first integer in the coords.
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"No Input File Selected" Error in HtAccess, how do I fix? dcshoeco1 Coding Forum 5 03-27-2008 02:05 AM
<meta http-equiv="Pragma" content="no-cache" /> FGTH SEO Forum 4 06-21-2007 12:29 PM
Home page with "latest news", "news archive" and "update" tekitouni Web Design Lobby 1 09-19-2006 08:39 PM
"v7ndotcom elursrebmem" already bigger than "Nigritude Ultramarine"! Jim Westergren SEO Forum 31 01-21-2006 12:26 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 03:58 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2014 Escalate Media




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.