-
November 24th, 2001, 07:20 PM
#1
Junior Member
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--
-
November 24th, 2001, 07:24 PM
#2
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??
-
November 24th, 2001, 10:27 PM
#3
Senior Member
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
-
November 24th, 2001, 10:31 PM
#4
Hey, thanks for that, It'll probably be useful for me as well... I do lots of javascript stuff on my web sites!
-
November 24th, 2001, 11:09 PM
#5
-
November 24th, 2001, 11:12 PM
#6
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!
-
November 24th, 2001, 11:13 PM
#7
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!
-
November 24th, 2001, 11:21 PM
#8
Senior Member
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 ?
-
November 24th, 2001, 11:22 PM
#9
Senior Member
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
-
November 24th, 2001, 11:23 PM
#10
Senior Member
did this link come up before....its not shown..
O well reposted
http://www.cigital.com/javasecurity/links.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|