473,480 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Safari interprets 'submit()' as method 'POST'

I ran into an interesting problem while working on a form:

I have a drop down list (think <form><select><option>...) of 'open
sessions' which a user can choose from to continue entering data.
There is a small bit of javascript which, when the 'onChange' event
occurs, triggers a 'submit' which reloads the page and displays the
stored values for that session using a session ID variable named,
'$existingSessions'.

Even though the form's method is set to "GET", Safari insists on
seeing this as a "POST" as a result of the javascript submit call,
while all other browsers I tested (Firefox/Mac, IE/Mac, Firefox/PC,
IE7/PC) interpret this as a "GET".

So at the top of the PHP script, $existingSessions =
$_POST['existingSessions'] will ONLY work with Safari while all other
browsers (which I tested) require $existingSessions =
$_GET['existingSessions'] in order to retrieve the values.

Has anyone else run into this issue? I handled it with a simple
HTTP_USER_AGENT request and an if...else statement. Still, I'd like to
know what's up with this! Is it just because Safari is a semi-sucky
browser?

May 11 '07 #1
1 3494
On May 11, 10:53 am, ryn...@gmail.com wrote:
I ran into an interesting problem while working on a form:

I have a drop down list (think <form><select><option>...) of 'open
sessions' which a user can choose from to continue entering data.
There is a small bit of javascript which, when the 'onChange' event
occurs, triggers a 'submit' which reloads the page and displays the
stored values for that session using a session ID variable named,
'$existingSessions'.

Even though the form's method is set to "GET", Safari insists on
seeing this as a "POST" as a result of the javascript submit call,
while all other browsers I tested (Firefox/Mac, IE/Mac, Firefox/PC,
IE7/PC) interpret this as a "GET".

So at the top of the PHP script, $existingSessions =
$_POST['existingSessions'] will ONLY work with Safari while all other
browsers (which I tested) require $existingSessions =
$_GET['existingSessions'] in order to retrieve the values.

Has anyone else run into this issue? I handled it with a simple
HTTP_USER_AGENT request and an if...else statement. Still, I'd like to
know what's up with this! Is it just because Safari is a semi-sucky
browser?
To resolve this at the PHP end, you can just use $_REQUEST instead
which is a combination of $_GET, $_POST, and $_COOKIE.

To resolve this in the browser, you can create a submit button in the
form next to the jumpbox, and in the onchange for the jumpbox do
document.forms['whatever'].elements['goBtn'].click()
Note that I mean the name attribute of the go/submit button is
'goBtn'. This method will also allow people who don't have JavaScript
enabled to use the go button to change the session. I've run into
strange behavior with form.submit() before, and I had to use
submitBtn.click() instead. I'm not absolutely sure this solution will
fix your problem at the browser end, but it usually fixes my problems
with form.submit().

-Mike PII

May 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1933
by: bob | last post by:
I hope this is the right group to ask. I need help from a safari guru. I seem to have problems getting safari web browser to execute perl scripts. The code I have is pretty standard. My html...
1
1933
by: gerry | last post by:
Hi, although this is not strictly asp.net related, I was hoping that someone could confirm or debunk what appears to be a major problem with safari POSTs. with the following html : <!DOCTYPE...
2
3357
by: JThomas | last post by:
Hello! I'm having trouble with a page apparently causing my client's Safari browser to time out. I don't actually have access to a Mac & Safari, and haven't been able to physically see this...
6
5266
by: dpodkuik | last post by:
I have a simple function that does submit for me: <script language="javascript" type="text/javascript"> function sort() { //selected item value from the drop down list var...
2
17066
by: cbjewelz | last post by:
Hey all. So I'm having problems with cross browser alignments. I'm looking at Safari and Mozilla Firefox. I develop in Safari and so it looks perfect there however in Firefox my vertical...
2
2966
by: darren | last post by:
I have a small Javascript problem with that mutch love web browser safari, I tested the code on all other browsers PC (Win) and Linux and IE on the mac and it seams to work ok, but for some reason...
5
2188
gregerly
by: gregerly | last post by:
Ok, I've got an ajaxed calendar that lets users add their own events. This works great in Firefox and IE. In Safari however, i'm getting errors as the response text, instead of the success or...
1
3181
by: Jacqui | last post by:
Hi, I am trying to write a webpage that has a form on it, which gets submitted when a button is pressed, but also has an onclick event which does some DOM manipulation to display a waiting page....
2
4755
by: rudiedirkx | last post by:
Gents, I have a problem (only in Safari) with the onsubmit in webforms. This topic covers the same subject: http://bytes.com/topic/javascript/answers/166542-onsubmit-safari but not as detailed as...
0
7050
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7091
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2999
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.