PDA

Click to See Complete Forum and Search --> : [RESOLVED] Buttons work in Firefox, but not IE


buffy
Feb 22nd, 2009, 09:34 PM
Hi guys,

I have a site that works in Firefox but not IE, argh.

Two buttons, (1) opens a popup window with a larger image, (2) another adds the product to the cart....

In IE, the popup button does nothing, just presses down like normal. And the cart button shows the image saying something has been added, but really its all lies, as when you go to the basket its empty.

Okay, code time....

1) "View Larger Image" popup window button, works fine in Firefox, except the page title is images.php rather then the page title, but thats no biggie.


<form>
<input name="button" type="button" onClick="window.open('<?PHP echo "imagebig.php?productid=$productid"?>','Handle Bar Ends','width=485,height=340,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no ,resizable=no,left=200,top=50,screenX=200,screenY=50');return false" value="View Large Image">
</form>


2) Add to cart ...... refreshes the page, performs some php code adding the item to the order table. Again works in Firefox, but not IE.


<form name="<?php echo 'order'.$productid; ?>" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<input name="quantity" type="text" id="quantity4" value="1" size="4" maxlength="3">
<input name="submit" type="submit" value="Add to Cart">
<input type=hidden name=productid value=<?PHP echo $productid;?>>
</form>



Any help is appreciated!

dclamp
Feb 22nd, 2009, 10:41 PM
The issue you are having is not with PHP specifically. It is with the javascript and browser incompatibilities.

May i suggest using AJAX, then you can skip the popup all together, as some users may have a popup blocker.

Also, have you checked that Javascript is enabled in IE?

kows
Feb 22nd, 2009, 11:14 PM
For the javascript window problem, IE won't let you have a window with spaces in its name. Remove the spaces from the name by changing "Handle Bar Ends" to something like "handlebarends." Remember, this is your window's NAME and not title.

The only problem with your second form is that your "hidden" parameter is -after- your submit. If IE only processes the elements in the form -before- the submit button, then this will surely give you an issue. Other than that, there is no browser specific problem with the form. A form is a form, and as long as it doesn't have JavaScript within it, there should never be compatibility issues.

Also, AJAX isn't exactly an alternative to having an image preview window. And, any browser with a popup blocker worth having distinguishes between popups that are automatic, and ones that are opened by the user.

buffy
Feb 24th, 2009, 09:17 PM
Thanks dclamp and kows - I am not that familiar with AJAX so I did the option of changing the name to something_like_this and then it worked in IE - horrah!

So thats cool .... and yes it looks like the form is not the issue.... sometimes the cart works and sometimes it doesn’t. I think it has to do with whether a pre-existing session exists or something, I'm not too sure... so much problems argh...

So have decided to fix something that I thought worked but doesn't, will put it in another post since this one is resolved, thank you both :)

New post: Order record (order table) not deleting once products have been removed from OrderItem table. (http://www.vbforums.com/showthread.php?p=3455576#post3455576)