General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 18th, 2003, 05:53 PM
Robert K S Robert K S is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Cleveland OH USA
Posts: 8 Robert K S User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Robert K S
Disabled submit button prevents form submission

I have a web form that submits to itself--a guestbook, for example. I have tried all the usual JavaScript techniques for disabling the Submit button (to prevent inadvertant multiple submissions), but they also prevent proper functioning of the page.

The PHP code in the page that tests whether the form has been submitted is

if (isset($_POST['submit']) && $_POST['submit'] == 'Add guestbook entry') {
// Error-check, then insert entry into database rather than displaying the form again
}

But this condition always fails, and I'm wondering why. Is it because the submit button has been disabled?

Can anyone help?

Reply With Quote
  #2  
Old December 18th, 2003, 10:19 PM
Robert K S Robert K S is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Cleveland OH USA
Posts: 8 Robert K S User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Robert K S
Thumbs up Solution

if ($_SERVER['REQUEST_METHOD'] == 'POST')

is the conditional that should be used.

Problem solved, and thanks to John Holmes. (Hope this helps somebody else in the future.)

Reply With Quote
  #3  
Old December 18th, 2003, 10:30 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
If i remember correctly, the submit button data is only passed if you click the submit button with your mouse (or trigger the button in general)...

If you press enter from any other field (a textbox for example) in the form than the submit information isn't sent...

Assuming i'm right (i haven't tested this in on current browsers), than I'd suggest perhaps a hidden field containing any information you want (just to validate).

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Disabled submit button prevents form submission


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway