Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

predicador

@predicador
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • PHP form processing: the easy way
    P predicador

    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?

    The Weird and The Wonderful help php question

  • PHP form processing: the easy way
    P predicador

    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

    The Weird and The Wonderful help php question

  • PHP form processing: the easy way
    P predicador

    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 Weird and The Wonderful help php question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups