It is currently Fri May 09, 2025 1:05 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post Post subject: Is my form filled checker
 
Offline
Godlike Poster
Godlike Poster
Years of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membership
User avatar

Joined: Sun Oct 16, 2005 9:42 am
Posts: 8798
Karma: 17

Location: Imagine in your mind a posh country club
Steam Login Name: azcn2503
This is something I just thought of.

I guess it will be really handy if you're constantly checking for form inputs, for example when a user is logging in, registering, or just filling in any old form that requires certain data.

You pass the variables to check for, it checks them, then if one of them isn't filled it can return a value; boolean or any error code you want I guess - modify it to suit your needs.

So yeah, the concept is rediculously simple but I am sure this will actually help someone (probably just me).

By the way, I have no access to a server, so I can't test this code.

Code:
function checkIsFilled($a){
   $con=1;
   if(gettype($a)=="array"){
      foreach($a as $v){ $con=$v==""?0:$con==null?0:$con; }
   }
   else{
      $con=0;
   }
}


Usage would be:

Code:
<?php
if(checkIsFilled(array($_POST["username"],$_POST["password"]))){
// continue
}
else{
// not filled so cant continue
}


And yes, it's made to work with arrays, so is great for lots of fields! I guess you could pass the entire $_POST or $_GET arrays but I think they function slightly differently from normal arrays.

Give me some feedback and err... yeah let me know if it works.

_________________
Follow your heart and live the dream <3


Fri Dec 12, 2008 6:09 pm 
 Profile E-mail  
 
 Post Post subject: Re: Is my form filled checker
 
Offline
Eagle Eye (Mod)
Eagle Eye (Mod)
Years of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membershipYears of membership
User avatar

Joined: Fri Oct 14, 2005 7:15 am
Posts: 2128
Karma: 20

Location: On the Internet
Steam Login Name: kyhas
If i understood it and it's still valid i'd try it :P

_________________
Image


Fri Mar 27, 2009 9:59 am 
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Karma functions powered by Karma MOD © 2007, 2009 m157y