1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Windows Who knows how to HTML?

Discussion in 'Software' started by chrisb2e9, 27 Jun 2012.

  1. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    Hello,
    I need to make something.
    Basically what I want to do is have a bunch of fields with drop down menus.
    For example:
    the first field is a year going from present back to whenever.
    Someone selects a year from a drop down list and then in the next drop down list they select a make of car. for example, Toyota.
    Then there is another field, for the model of car, for example corolla.
    And then another one for car options, for example 2 door or 4 door etc.

    Once you have filled them out you will automatically be taken to a page that gives you information about that year, make, and model of car.
    I have no idea how to code this. Help!

    If you can show me what code I need that would be amazing!
    Or if you know of a resource that can show me how to do it that would rock as well.

    Thanks!
     
  2. Matticus

    Matticus ...

    Joined:
    23 Feb 2008
    Posts:
    3,347
    Likes Received:
    117
    You are going to need some server side scripting and some sort of database to achieve that. Your best bet is to learn a little bit of php.

    If you look for tutorials on populating a drop down list from a database, most will show how to make them link together as you suggest.

    Essentially what it would be doing is querying a list of models based on the selected make ID of the first box. So when you select Toyota lets say it has a ID value of 10 in a database table of called "makes", the model drop down box will perform a query which in layman's terms will say "select all the models in the models table that have the make ID of 10".

    I will find a few tutorials in a moment.

    Edit: How dynamic are you wanting this, are you happy with the page reloading when a drop down is selected (should be a super quick reload if you keep the page light) or do you want it to all be done without any page reloads. If you want the latter, you will need to use ajax requests and possibly jQuery?

    Edit 100000: I have removed the link to the original example because it is pretty terrible, and not worth looking at.

    I will write something quickly tomorrow :thumb: in the mean time get on w3 schools and read up on HTML and PHP, I would probably leave jQuery for now and just get to grips with the principles of PHP and how to layout a basic page with HTML and CSS.

    I will be more of a help tomorrow, I am just off to bed now so don't want to get into any coding :hehe:
     
    Last edited: 28 Jun 2012
  3. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    awesome! thank you!
     
  4. GoodBytes

    GoodBytes How many wifi's does it have?

    Joined:
    20 Jan 2007
    Posts:
    12,300
    Likes Received:
    710
    Here are some really good tutorial sites:

    -> http://www.w3schools.com/html/html_forms.asp (direct link to the HTML Forms tutorial)
    -> PHP tutorial: http://www.w3schools.com/php/default.asp

    PHP is a language that you merge with HTML page. well actually the contrary... you have a .php file, and you have HTML code inside.
    Here are things that you can do with PHP:

    Code:
    <?php
     // This is my PHP part
     echo "Hello! I am outputing some <b>HTML</b>. The web browser source code will not see code but the message, with 'HTML' marked in bold, as if I did it in HTML, as it is code  compiled on the server automicaly. I don't have have to do anything beside sending my php page(s) to my server, the same way I do my HTML pages!<br/><br/>"
    
    // end of PHP
    ?>
    Hello again!, This is my HTML part. Anything here is in HTML format.<br/><br/>
    <?php
    $myVar = true;
    if ($myVar == true) {
      echo "Amazing! I am back in HTML, but outputting on the page, using 'echo' HTML code. BTW, that value for myVar is ".$myVar.". Truly interesting fact!";
    } else{
      echo "Double amazing! I am back in HTML, but outputting on the page, using 'echo' HTML code. BTW, that value for myVar is ".$myVar.". Yup it's false!";
    }
    ?>
    
    How to test PHP page?
    Here is the thing. PHP is code compiled on the server.. so if you load the PHP page in your web browser.. well, you'll see your page as if you opened it in Notepad... practically, and not what you wanted. It needs to be compiled. TO do this, you need to make your computer a server. As much scary as it sounds, it's rather easy.. especially that it's an offline server... so you have nothing to worry about.

    You can use Microsoft WebMatrix 2, a real nice coding software for web pages. Easy to use, and it comes built-in server. All you have to do, is hit the "Run" button on the ribbon bar of the program, and poof! Your see your PHP (or HTML) as if it was uploaded on your server. It also debug your code as code it. HTML, CSS, and PHP.

    Microosft Webmatrix is 100% free, and you can do commercial content with it.
    http://www.microsoft.com/web/webmatrix/
    You can also publish your website to your own server form the program. The program will see what has changed, what files has been added (very smart system, btw), and uploads these files your web server, and now everyone can see it.
     
  5. aLtikal

    aLtikal 1338-One step infront of the pro's

    Joined:
    7 May 2008
    Posts:
    944
    Likes Received:
    30
    You can also use WAMP which will run your PHP. Not sure of the differences between microsofts offering and wamp though
     
  6. Guinevere

    Guinevere Mega Mom

    Joined:
    8 May 2010
    Posts:
    2,484
    Likes Received:
    176
    What size is the total dataset? How many cars?

    I'd wager it's not a huge list and in plain text comparable to a reasonable sized image.

    So rather than go with an active scripting solution (PHP, .NET etc) and AJAX just look at a 100% javaScript solution. Embed all the options in an array and code up a cascading list of selects.

    http://www.tek-tips.com/faqs.cfm?fid=6294
    http://www.javascriptkit.com/javatutors/selectcontent2.shtml

    If your dataset is too large to load at once, then look at basic AJAX techniques to load a select list from an external file. (Tip = Look at .innerHTML).

    If your list of cars etc isn't going to be in a database you can dispense with PHP etc and use 100% javaScript and plain text (HTML) files to load on demand. It's a bit clunky, but no more than using PHP for nothing more than an "If - else" or big-ol' switch statement.
     
  7. GoodBytes

    GoodBytes How many wifi's does it have?

    Joined:
    20 Jan 2007
    Posts:
    12,300
    Likes Received:
    710
    WAMP is just the server thing
    Microsoft solution is fast, light and doesn't slow your Windows startup.
     
  8. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    oy, way over my head. I was hoping this would be sort of easy.

    Years going from present back to 2000 and in some cases back to 1990
    All makes of cars (except for some of the exotic stuff)
    All models of cars.
    All options for cars.
    And pictures, not just text.
    In other words, this is massive. Currently we have a book(in a three inch binder that is over full) for this but as we are moving to tablets I want to get this information into the tablet. And make it as easy as possible for people to look up.

    Am I going about this the right way or can you suggest something else?

    Maybe just links so a page that starts with all the years
    click on a year and it takes you to a page for all the makes and so on. would be a lot of work but it's simple work and I would just need a reminder of basic html instead of learning something new.
     
  9. StingLikeABee

    StingLikeABee What's a Dremel?

    Joined:
    17 Nov 2010
    Posts:
    562
    Likes Received:
    23
    Code:
    <form>
    <select name="year">
    <option value="1991">1991</option>
    <option value="1992">1992</option>
    <option value="1993">1992</option>
    <!-- REPEAT OPTIONS AS MANY TIMES AS REQUIRED, EACH WITH THE UNIQUE VALUE AND TEXT -->
    </select>
    
    <select name="Make">
    <option value="Toyota">Toyota</option>
    <option value="Ford">Ford</option>
    <option value="Another">Another/option>
    <!-- REPEAT OPTIONS AS MANY TIMES AS REQUIRED, EACH WITH THE UNIQUE VALUE AND TEXT -->
    </select>
    
    <select name="Model">
    <option value="KA">KA</option>
    <option value="SCAMOBILE">SCAMOBILE</option>
    <option value="ANYTHING">ANYTHING</option>
    <!-- REPEAT OPTIONS AS MANY TIMES AS REQUIRED, EACH WITH THE UNIQUE VALUE AND TEXT -->
    </select>
    </form>
    
    That would be the very (very) basics of the form. You would then need to find a way to chain the dropdowns, and then create a form handler to process the form. This isn't something someone with limited experience can jump into, without investing some time in learning the basics. As already mentioned, I would recommend PHP for the form handler, and there are many tutorials available online that you can learn from, and accomplish what it is you want to do.

    EDIT: It's also worth mentioning that HTML deals with the layout of websites, and not with dynamic tasks like you want. You really need to learn either a server side scripting language (like PHP) or you could do it with jquery (but that would be the messy way).
     
  10. GoodBytes

    GoodBytes How many wifi's does it have?

    Joined:
    20 Jan 2007
    Posts:
    12,300
    Likes Received:
    710
    Agreed.
    I recommend for your database MySQL, which most web server have already installed and support.
    There is also a workbench software for MySQL (free), so that you can create and edit your database visually directly from your web server.
    Download here: http://www.mysql.com/products/workbench/
     
  11. Modsbywoz

    Modsbywoz Multimodder

    Joined:
    14 Oct 2009
    Posts:
    2,778
    Likes Received:
    273
    I would recommend the PHP/MySQL solution to be honest. You will want the page to load as fast as possible with the iPad especially if it is on 3G or something similar.
     
  12. Matticus

    Matticus ...

    Joined:
    23 Feb 2008
    Posts:
    3,347
    Likes Received:
    117
    Oops completely forgot about this, I will get something together over the weekend, I have been doing PHP and MySQL all week so understandably I am in no rush to do more :hehe:
     
  13. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    No worries, I've been putting together all the info. Last night I looked into how large the current files are. Everything in power point presentations and take 1.5gb of information.
    Makes me wonder if I should scan from paper or take screen shots of each slide...
    This is going to take me a while...
     
  14. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    I currently have two years worth of car folders made. And I have made over 1000 folders. only 15 more years to go....
    I might cry.
     
  15. sourdough

    sourdough Minimodder

    Joined:
    17 Sep 2010
    Posts:
    123
    Likes Received:
    1
    perhaps a content management system e.g. drupal, joomla, etc.
     
  16. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    I don't understand, what is that?
     
  17. deathtaker27

    deathtaker27 Modder

    Joined:
    17 Apr 2010
    Posts:
    2,238
    Likes Received:
    186
  18. chrisb2e9

    chrisb2e9 Dont do that...

    Joined:
    18 Jun 2007
    Posts:
    4,061
    Likes Received:
    46
    I don't understand how that would save me any time. I still have to create a few thousand more folders. writing the html is pretty quick and easy. Copy and paste. How would a program like that save me any time?
     
  19. Panomama

    Panomama I once signed up on uniform dating

    Joined:
    11 Jul 2009
    Posts:
    1,107
    Likes Received:
    39
    Basic, it's 3am.

    Code:
    create database web_cars;
    use web_cars;
    
    CREATE TABLE cars
    (
    carid int auto_increment primary key, /*ID of car, going up */
    year varchar(20), /*1981,1982,1983 etc etc  */
    make varchar(20), /* Toyota, Ford, Ferrari etc etc*/
    carmodel varchar(50), 
    caroptions varchar(50), /* 2door,4door*/
    extra varchar(50) /* Type of car? Sports, estate or something of the like */
    );
    
     
  20. sourdough

    sourdough Minimodder

    Joined:
    17 Sep 2010
    Posts:
    123
    Likes Received:
    1
    If you are going to catalogue that much information, it would be a shame not to store it in a readily accessible format - a (mysql) database. Basically all you need to do is to create a database, write the form to do the data entry, then you can decide afterwards how you want your site to look. You can usually accomplish what I said in a few clicks using a CMS.
     

Share This Page