1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do i find pre defined field information

Discussion in 'Programming' started by mindiam1, Sep 17, 2015.

  1. #1
    Hello all!

    I am trying to build a dating website and i need to create fields people can fill out which contact the following information:

    Height:
    Weight:
    Shoe size:
    Ethnicity:
    Hair colour:
    Skin colour:

    You get the idea...

    Where could i find a table or database online for free which might have these option selections so I can code it into my website when a user fills out his profile.

    I have looked everywhere but cant find anything... any suggestions..?:(
     
    mindiam1, Sep 17, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Well... first of all, those for size should simply be a text/numbers field. If you want to make 100% sure that everyone adhers to the same units of measure, you can of course make it a select-list, but that is very easily made using whatever server-side language you're using - just make a loop which start at a value (the minimum one) and ups with whatever jump you want - for height, start at 140cm and add 1 up to 210? Or something like that.
    As for ethnicity, just get a list of all the countries with country-codes and such. There are plenty of these available online, including Wikipedia. You'll usually have to do a bit of tinkering to get it into a database, but it's not really complicated or hard work.
    As for hair and skin-colour, that's not really that hard, is it? Depending on how many choices you want, just loop from an array.
     
    PoPSiCLe, Sep 18, 2015 IP
    mindiam1 likes this.
  3. mindiam1

    mindiam1 Well-Known Member

    Messages:
    1,190
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Is there a website which would provide a database of these options e.g.

    Weight:
    1. 50kg / 110 lb
    2. 51 / 112 lb
    3. 52 / 114 lb

    So instead of me manually research and making these for hundreds of variations?
     
    mindiam1, Sep 18, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    If you just want to create variables based on a given equation, creating that wouldn't be too hard. I'm not aware of anywhere where you can find that particular datagrid, however.
    
    <?php
    
    for ($i=1; $i <= 250; $i++) {
       $pound = floor($i * 2.204);
    echo $i.' kg / '.$pound.'<br>';
    //remove the floor() to get a more exact value
    }
    
    ?>
    
    PHP:
     
    PoPSiCLe, Sep 18, 2015 IP
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    Same goes for height, although it's slightly more complicated as you need to convert to both feet and inches.
    It's not rocket science. Nor is it hard to input into a database so you can pick out the limits you want (say, someone searching for people between 50 and 70 kgs)
     
    PoPSiCLe, Sep 18, 2015 IP
  6. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #6
    If you don't want to code from scratch, then something like this would be very simple in Drupal (using the now core Fields module plus some additional ones) and it can (with the right modules - Units api and a module such as MVF) do unit conversion.
     
    ryan_uk, Oct 4, 2015 IP