SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 16th, 2002, 07:44 PM
STeeL STeeL is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 STeeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
form validator

what is the difference between:

if($HTTP_POST_VARS['submit'])
and
if(!isset($submit))

which one do you prefer?

Reply With Quote
  #2  
Old June 16th, 2002, 10:53 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: form validator

The difference is that sometimes you might want to send $submit as the actual string "false", this will evaluate to false in "if ($HTTP_POST_VARS['submit'])" but true in "if (isset($submit))"..

Oh, i purposefully took the "!" out... that makes the functionality between the two statements completely incomparible as they perform two totally different things.

The safest is probably to use :

php Code:
Original - php Code
  1.  
  2. <?
  3.   if (isset($_POST["submit"])) {
  4.   }
  5. ?>


because this way php won't hit any notices when (in first one) the 'submit' index wasn't created and (in second one) the submit variable (probably) hasn't been defined (before the form is submitted).

When I code without worrying about notices, i'd attach a action=submit somewhere in the form then...

php Code:
Original - php Code
  1. <?
  2.   switch ($action) {
  3.     case "submit" : submitted(); break;
  4.     default : notSubmittedYet(); break;
  5.   }
  6. ?>


...

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > form validator


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 5 hosted by Hostway