Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Funkcjonalność tej witryny będzie ograniczona w czasie konserwacji. Jeśli artykuł nie rozwiązuje twojego problemu i chcesz zadać pytanie, to nasza społeczność wsparcia jest dostępna na @FirefoxSupport na Twitterze i /r/firefox na Reddicie.

Przeszukaj pomoc

Unikaj oszustw związanych z pomocą.Nigdy nie będziemy prosić Cię o dzwonienie na numer telefonu, wysyłanie SMS-ów ani o udostępnianie danych osobowych. Zgłoś podejrzaną aktywność, korzystając z opcji „Zgłoś nadużycie”.

Więcej informacji

Firefox submits form twice... why?

  • 1 odpowiedź
  • 3 osoby mają ten problem
  • 1 wyświetlenie
  • Ostatnia odpowiedź od cor-el

more options

Hi All,

I'm getting some really weird behaviour from Firefox (7.0.1).

I writing a little blackjack training script in php. The script shuffles four decks of cards, then uses the shuffled shoe until it reaches the end, at which time it reshuffles.

Each card is then dealt from the shuffled deck in sequence, and used cards aren't recycled until the next shuffle.

The suffled sequence of cards and the current card number in the sequence are stored by php in $_SESSION variables.

So far, what I've written works fine in Chrome/Iron, Safari, IE and Opera, but an error in Firefox has me baffled.

This form creates a slection of next activities...

HTML Code: <form name='what' id='what' method='POST' action='blackjack.php' target='_self'> <input type='hidden' id='act' name='act' value=> <input type='hidden' id='draw' name='draw' value='".$draw."'> <input type='button' value='DRAW' onclick="set('draw')"> <input type='button' value='DOUBLE' onclick="set('double')"> <input type='button' value='SPLIT' onclick="set('split'); return false;"> <input type='button' value='STAND' onclick="set('stand'); return false;"> <input type='button' value='DEAL' onclick="set('deal'); return false;"> <input type='button' value='SHUFFLE' onclick="set('shuffle'); return false;"> </form>

And this little bit of javascript adjusts the value of 'act' and submits the form... HTML Code: <script type='text/javascript'> function set(w) { document.getElementById('act').value = w; document.getElementById('what').submit(); } </script>The php script will only shuffle the deck when act="shuffe" or act="".

However, in Firefox, the deck is shuffled on every submit.

I put some tracers in the php script and saw something weird. When firefox submits the form, it does so twice, once with the values of act and draw set, and the other with no values. What's returned to the browser is the result from the first submit (with the values set) except that by the time the php reaches the part of the code that retrieves the shoe, the second submit seems to have stored a new shuffled deck in the session variable.

You can try it, and see the source code and tracers here (though don't expect a functioning game)... BlackJackBlack

My brain hurts. Any thoughts?

CTB

Hi All, I'm getting some really weird behaviour from Firefox (7.0.1). I writing a little blackjack training script in php. The script shuffles four decks of cards, then uses the shuffled shoe until it reaches the end, at which time it reshuffles. Each card is then dealt from the shuffled deck in sequence, and used cards aren't recycled until the next shuffle. The suffled sequence of cards and the current card number in the sequence are stored by php in $_SESSION variables. So far, what I've written works fine in Chrome/Iron, Safari, IE and Opera, but an error in Firefox has me baffled. This form creates a slection of next activities... HTML Code: <form name='what' id='what' method='POST' action='blackjack.php' target='_self'> <input type='hidden' id='act' name='act' value=''> <input type='hidden' id='draw' name='draw' value='".$draw."'> <input type='button' value='DRAW' onclick="set('draw')"> <input type='button' value='DOUBLE' onclick="set('double')"> <input type='button' value='SPLIT' onclick="set('split'); return false;"> <input type='button' value='STAND' onclick="set('stand'); return false;"> <input type='button' value='DEAL' onclick="set('deal'); return false;"> <input type='button' value='SHUFFLE' onclick="set('shuffle'); return false;"> </form> And this little bit of javascript adjusts the value of 'act' and submits the form... HTML Code: <script type='text/javascript'> function set(w) { document.getElementById('act').value = w; document.getElementById('what').submit(); } </script>The php script will only shuffle the deck when act="shuffe" or act="". However, in Firefox, the deck is shuffled on every submit. I put some tracers in the php script and saw something weird. When firefox submits the form, it does so twice, once with the values of act and draw set, and the other with no values. What's returned to the browser is the result from the first submit (with the values set) except that by the time the php reaches the part of the code that retrieves the shoe, the second submit seems to have stored a new shuffled deck in the session variable. You can try it, and see the source code and tracers here (though don't expect a functioning game)... [[www.blackjackblack.com|BlackJackBlack]] My brain hurts. Any thoughts? CTB

Wszystkie odpowiedzi (1)

more options

A good place to ask advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
The helpers at that forum are more knowledgeable about web development issues.
You need to register at the mozillaZine forum site in order to post at that forum.

See http://forums.mozillazine.org/viewforum.php?f=25