Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: using html forms

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    20

    using html forms

    I have got a questions about html forms....I figured I would put this in the tutorial section because it can be a tricky subject.

    Now my question is when creating a form for a web page the setup is pretty easy to have a form that will not execute anything just the form. I am having a little trouble with the setup of the database for the form. I do not actually have a provider (web page provider) yet and i was wondering if this was my problem.

    First where should the database be created, before the head or after? Second should it be after the form or before? I can not get it to search the database. For example if you wanted to have a list of movies and the user would then type in the movie name. How can you make the form search the database right from the actual natepad? Or is it impossible.
    I am learning java now but until I figure this out I am dead in the water. Any leads would be great. Thanks
    --blayde--

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    I don't know quite what you're trying to do, but it sounds like you're searching a list and then directing users depending on the search result? or displaying the results in the browser or something... As far as I know, all this is possible with a bit of JavaScript... you don't even need Java as far as I know...

    Given a bit more info I could probably try to run together a bit of JS that might at least help you understand the workings of it and how to do what you actually want it to do??
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Posts
    130
    http://freewarejava.com/cgi-bin/foru...er=4&SUBMIT=Go

    I used this site when i got a lil stuck on forms, its all html based, java, all kinds of programming..might help

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    Hey, thanks for that, It'll probably be useful for me as well... I do lots of javascript stuff on my web sites!
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  5. #5
    Senior Member
    Join Date
    Aug 2001
    Posts
    130

    Lightbulb Applets

    No problem

    I found this a good read the other day, its got some hostile applets on aswell, good to teach yourself about security aspects of java. I have used a bit on my site aswell

    u might enjoy

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    Kool.

    I'm only just starting to get into JavaScript, and Java, and stuff, but it seems really easy to learn and use compared to C++ which I'm learning the advanced stuff of now!
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  7. #7
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    Well, when i say advanced, I mean like how to get C++ Builder programs to connect to the internet and do stuff liek ping and traceroute and portscanning!
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  8. #8
    Senior Member
    Join Date
    Aug 2001
    Posts
    130

    Arrow

    Ive yet to get into C C++ properly, the languages ive done so far are limited, pascal, html, java, VB, tiny bit of perl and cgi..but i'm know master, just chugging along.

    The net tools you mentioned sounds intresting, i'd like to be able to do my own programs like that. See how they work on the net, from scratch..ect..

    Where did you start ?

  9. #9
    Senior Member
    Join Date
    Oct 2001
    Posts
    101

    Re: using html forms

    Ok, this is going to take some explaining but, here goes:
    First where should the database be created, before the head or after?
    The database should already be created unless you are storing your 'movie' names in an array. If you are using an array then you will have to make it before the form (so it is executed before the form is displayed). I personally would use a database like mySQL or Access, etc to store this information. Better than an array and easier to update (anytime you want to update your array by adding movies you'd have to edit the code in the actual page).

    Second should it be after the form or before?
    Ok, if you are loading from a real database, not an array this is what you do. Top of page - make the connection to the database and load the recordset (the collection of all records in the database). Then, load your form with a loop in it, making a new option for every record in the recordset. After the form has been displayed, close the recordset.

    For example if you wanted to have a list of movies and the user would then type in the movie name.
    Ok, now you have to write some sql scripts. This would be like "SELECT * From movielist Where movie_name = '" & strParamater & "' Order By movie_name DESC". Something like that. This would not be done in the same place. This would be in your handler method (if request("submit") <> null or something like that). You would check the form (using your name tags on elements) by doing something like strParamater = Request("movie_name") and then do a get from the database recordset. Wow, then you would display this information. If you do this, make sure to test for 0's cuz you might get a recordset with nothing in it (if there were no movies of that name). The only problem with that sql script I gave you is it will only look for exact matches I believe (can't quite remember my SQL).

    How can you make the form search the database right from the actual natepad? Or is it impossible.
    Impossible. Notepad is only displaying text, it is not scripting.

    If I were you and I wanted to do this, I would look into learning JSP (since you already know Java) or learn ASP (VB is really easy to learn). All form processing is done on the server side, not the client side. JavaScript is useful for transfering info around on the page after it has been displayed, but it will not do much else (as far as form handling, database querrying etc goes).

    To learn some JSP go here: P2P at Wrox. Or search for JSP. One problem I noticed that you have is you do not have a web host. You need one and you need to decide on your scripting language depending on the web server they are using. Ie. IIS = ASP, Apache = PHP, JSP etc etc.

    Anyways, hope this helps. If you need more help just reply to this or send me a message.

    PS Sorry for the length of the message.
    - Stronzo

    \"Vini, Vici, Vidi\"
    I came, I saw, I conquered.
    - Julius Caesar

  10. #10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •