PHP form processing: the easy way
-
Looks like perfectly normal PHP to me. You mean PHP doesn't have to look like a child wrote in in Quick Basic? If true, I am amazed... :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
The ability to write total garbage is language- (and culture-) independent. ;P X| with the possible exception of APL, where nobody can tell if it's garbage or clever code. Described to me years ago as the world's first write-only language. Cheers, Peter
Software rusts. Simon Stephenson, ca 1994.
-
The ability to write total garbage is language- (and culture-) independent. ;P X| with the possible exception of APL, where nobody can tell if it's garbage or clever code. Described to me years ago as the world's first write-only language. Cheers, Peter
Software rusts. Simon Stephenson, ca 1994.
Thanks! I've been trying to forget the existence of APL... :-D
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
An ex-coworker asked me to help him with his first website (maybe last?). It's for a real estate agency. He was stuck trying to process the search form with some selects (price range, state size, zone location, bla, bla.. ) All the code is a fucking mess, but this piece of crap excels among all other:
$filter='';
$type=$_POST['type']; // Home, Flat...
$admin=$_POST['admin']; // Buy, Rent
$zone=$_POST['zone']; // Situation area
$m2=$_POST['m2']; // Size, stands for square meter
$price=$_POST['price'];if(($type!="selec") AND ($admin!="selec") AND ($zone!="selec") AND ($m2!="selec") AND ($price!="selec")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemin!="") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$pricemin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec")){ $filter="type=\\"$type\\" AND admin>=\\"$admin\\""; }elseif(($type!="selec") AND ($pricemin!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemin\\""; }elseif(($type!="selec") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\""; }elseif(($type!="selec") AND ($city!="")){ $filter="type=\\"$type\\" AND city>=\\"$city\\""; }elseif($type!="selec"){ $filter="type=\\"$type\\""; }elseif($admin!="selec"){ $filter="admin=\\"$a
-
The ability to write total garbage is language- (and culture-) independent. ;P X| with the possible exception of APL, where nobody can tell if it's garbage or clever code. Described to me years ago as the world's first write-only language. Cheers, Peter
Software rusts. Simon Stephenson, ca 1994.
-
An ex-coworker asked me to help him with his first website (maybe last?). It's for a real estate agency. He was stuck trying to process the search form with some selects (price range, state size, zone location, bla, bla.. ) All the code is a fucking mess, but this piece of crap excels among all other:
$filter='';
$type=$_POST['type']; // Home, Flat...
$admin=$_POST['admin']; // Buy, Rent
$zone=$_POST['zone']; // Situation area
$m2=$_POST['m2']; // Size, stands for square meter
$price=$_POST['price'];if(($type!="selec") AND ($admin!="selec") AND ($zone!="selec") AND ($m2!="selec") AND ($price!="selec")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemin!="") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$pricemin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec")){ $filter="type=\\"$type\\" AND admin>=\\"$admin\\""; }elseif(($type!="selec") AND ($pricemin!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemin\\""; }elseif(($type!="selec") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\""; }elseif(($type!="selec") AND ($city!="")){ $filter="type=\\"$type\\" AND city>=\\"$city\\""; }elseif($type!="selec"){ $filter="type=\\"$type\\""; }elseif($admin!="selec"){ $filter="admin=\\"$a
"One can write Fortran in any language."
Time you enjoy wasting is not wasted time - Bertrand Russel
-
An ex-coworker asked me to help him with his first website (maybe last?). It's for a real estate agency. He was stuck trying to process the search form with some selects (price range, state size, zone location, bla, bla.. ) All the code is a fucking mess, but this piece of crap excels among all other:
$filter='';
$type=$_POST['type']; // Home, Flat...
$admin=$_POST['admin']; // Buy, Rent
$zone=$_POST['zone']; // Situation area
$m2=$_POST['m2']; // Size, stands for square meter
$price=$_POST['price'];if(($type!="selec") AND ($admin!="selec") AND ($zone!="selec") AND ($m2!="selec") AND ($price!="selec")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemin!="") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$pricemin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec")){ $filter="type=\\"$type\\" AND admin>=\\"$admin\\""; }elseif(($type!="selec") AND ($pricemin!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemin\\""; }elseif(($type!="selec") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\""; }elseif(($type!="selec") AND ($city!="")){ $filter="type=\\"$type\\" AND city>=\\"$city\\""; }elseif($type!="selec"){ $filter="type=\\"$type\\""; }elseif($admin!="selec"){ $filter="admin=\\"$a
Well a comment or two would be pretty handy, as well as some better spacing (though I'm hoping you crammed it all together so it would fit better on the page?). That is one heck of a if statement though...
-
Looks like perfectly normal PHP to me. You mean PHP doesn't have to look like a child wrote in in Quick Basic? If true, I am amazed... :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
that actually DOES look like something i wrote in qbasic when i was 10.
-
Well a comment or two would be pretty handy, as well as some better spacing (though I'm hoping you crammed it all together so it would fit better on the page?). That is one heck of a if statement though...
No, i didn't.. Sad but true ;) I've translated names and wrote the few comments...
¿Eres tu John Wayne? ¿O soy yo?
modified on Wednesday, June 8, 2011 12:59 PM
-
No, i didn't.. Sad but true ;) I've translated names and wrote the few comments...
¿Eres tu John Wayne? ¿O soy yo?
modified on Wednesday, June 8, 2011 12:59 PM
And I thought I was bad with comments... wow!
-
And I thought I was bad with comments... wow!
comments is the least of this codes problems.
-
And I thought I was bad with comments... wow!
D'oh! My Usual comments are not like this -_-'... Those were fast ones just for this post X| :laugh:
¿Eres tu John Wayne? ¿O soy yo?
-
An ex-coworker asked me to help him with his first website (maybe last?). It's for a real estate agency. He was stuck trying to process the search form with some selects (price range, state size, zone location, bla, bla.. ) All the code is a fucking mess, but this piece of crap excels among all other:
$filter='';
$type=$_POST['type']; // Home, Flat...
$admin=$_POST['admin']; // Buy, Rent
$zone=$_POST['zone']; // Situation area
$m2=$_POST['m2']; // Size, stands for square meter
$price=$_POST['price'];if(($type!="selec") AND ($admin!="selec") AND ($zone!="selec") AND ($m2!="selec") AND ($price!="selec")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND price<=\\"$pricemax\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemin!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemin\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$admin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemin!="") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND admin=\\"$pricemin\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($pricemax!="") AND ($city!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\" AND city=\\"$city\\""; }elseif(($type!="selec") AND ($admin!="selec")){ $filter="type=\\"$type\\" AND admin>=\\"$admin\\""; }elseif(($type!="selec") AND ($pricemin!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemin\\""; }elseif(($type!="selec") AND ($pricemax!="")){ $filter="type=\\"$type\\" AND price>=\\"$pricemax\\""; }elseif(($type!="selec") AND ($city!="")){ $filter="type=\\"$type\\" AND city>=\\"$city\\""; }elseif($type!="selec"){ $filter="type=\\"$type\\""; }elseif($admin!="selec"){ $filter="admin=\\"$a
Wow this is very nice code. I´ll zeropad it to fixed line length copy an inversion of it to the front, rotate counterclockwise 90 degrees, apply a color index substitution. Et voila, we´ve got a sprite for a space invaders clone.