Wednesday, January 14, 2009
Why I hate Blogger!
IE6 Problem with Form Submit Image Buttons
A lot of times we use images as our submit buttons for forms. I'm sure you've seen it a lot. Well, say you wanted to test if the form was submitted and used the standard way, lets say in PHP, of seeing if the submit button was sent, for example like this:
if (isset($_REQUEST['mysubmitbutton']))
{ ...}
With IE6 this wouldn't work if your submit button was an image. So if you had this as your submit button:
<input name="mysubmitbutton" type="image" value="1" src="someimage.png" alt="" />
Then your script wouldn't work. The reason is that IE6 WILL NOT send over the variable mysubmitbutton.
The workaround is to know that IE6 will send over other information (along with all other browsers). It sends the x and y coordinates of where you clicked on the image. So you'll see mysubmitbutton_x and mysubmitbutton_y. So if you modify your code to look for either of these variables, you'll be good to go!
Credit is to be given to this discussion forum: Differences in form handling btw Mozilla and IE?
Thursday, January 8, 2009
Get referrer with PHP
<?php
session_start();
if(!isset($_SESSION[’referrer’])){
//get the referrer
if ($_SERVER[’HTTP_REFERER’]){
$referrer = $_SERVER[’HTTP_REFERER’];
}else{
$referrer = “unknown”;
}
//save it in a session
$_SESSION[’referrer’] = $referrer; // store session data
}
?>
Monday, December 22, 2008
Making a Link Select a Select Box in Javascript
Tuesday, December 16, 2008
Server Root Path with PHP
Friday, December 5, 2008
Trim Whitespace in PHP
Description
This function returns a string with whitespace stripped from the beginning and end of str . Without the second parameter, trim() will strip these characters:
- " " (ASCII 32 (0x20)), an ordinary space.
- "\t" (ASCII 9 (0x09)), a tab.
- "\n" (ASCII 10 (0x0A)), a new line (line feed).
- "\r" (ASCII 13 (0x0D)), a carriage return.
- "\0" (ASCII 0 (0x00)), the NUL-byte.
- "\x0B" (ASCII 11 (0x0B)), a vertical tab.