I'm sorry, I've been experimenting with HTML for a while, memorized basically all common HTML tags, a few uncommon... But just recently, I started into javascripting. I read up on it in a book I got, but I don't understand how the submit function works, such as automatic posting in forums. I am working on a project that involves this sort of thing, and as soon as I understand this better and experiment, I may have more questions. Thanks in advance... I really seem to be having trouble... :)
Submit function... Explanation?
Started by Rammer124, Feb 01 2008 02:38 PM
7 replies to this topic
#1
Posted 01 February 2008 - 02:38 PM
|
|
|
#2
Guest_Jordan_*
Posted 02 February 2008 - 07:25 AM
Guest_Jordan_*
Do you have a specific question? I don't really know how to answer. If you need to know how to submit a form pragmatically here is some code to do that:
Which I took from How To Submit a Form Using JavaScript which also has a better description, examples and explanation.
<form name="myform" action="handle-data.php">
Search: <input type='text' name='query'>
<A href="javascript: submitform()">Search</A>
</form>
<SCRIPT language="JavaScript">
function submitform()
{
document.myform.submit();
}
</SCRIPT>
Which I took from How To Submit a Form Using JavaScript which also has a better description, examples and explanation.
#3
Posted 05 February 2008 - 08:08 AM
Thank you! Just one last question if it isn't too much trouble... What happens after somebody submits the form? Is it recorded into a database I can access when I am ready? I'm sorry if its too much trouble, but just a question.
#4
Guest_Jordan_*
Posted 05 February 2008 - 08:56 AM
Guest_Jordan_*
The code above does not. You will need something like PHP to insert it into a database.
#5
Posted 05 February 2008 - 10:49 AM
Danget. Thanks though. I looked into PHP once upon a time, but it was WAY over my head. I'm only 13... Still tryin to find what happens after somebody submits it... Thanks again!
#6
Guest_Jordan_*
Posted 05 February 2008 - 10:53 AM
Guest_Jordan_*
With the JavaScript above it just calls the function submitform() which executes:
which means it just presses the "submit" button on the website as if the user did. What happens after that depends on what it "action" is in the form header and what code gets executed.
document.myform.submit();
which means it just presses the "submit" button on the website as if the user did. What happens after that depends on what it "action" is in the form header and what code gets executed.
#7
Posted 05 February 2008 - 11:29 AM
Quote
<html>
<head>
<title>*********</title>
</head>
<body>
<center><form name="myform"
action="mailto:*******@gmail.com">
Username: <input type='text' name='username'><br>
Password: <input type='password' name='password'><br>
<A href="javascript: submitform()">Submit</A>
</form>
<SCRIPT language="JavaScript">
function submitform()
<br><br><br>
<marquee behavior="scroll" direction="left">Pressing "Submit" will
submit the form to me using e-mail. Thank you!</marquee>
</SCRIPT>
</body>
</html>
<head>
<title>*********</title>
</head>
<body>
<center><form name="myform"
action="mailto:*******@gmail.com">
Username: <input type='text' name='username'><br>
Password: <input type='password' name='password'><br>
<A href="javascript: submitform()">Submit</A>
</form>
<SCRIPT language="JavaScript">
function submitform()
<br><br><br>
<marquee behavior="scroll" direction="left">Pressing "Submit" will
submit the form to me using e-mail. Thank you!</marquee>
</SCRIPT>
</body>
</html>
Ok, I am beginning to understand this. Is there something wrong the the action tag? I want the form results sent to me through email. Thanks!
#8
Posted 05 February 2008 - 12:25 PM
Never Mind, I found an answer. Thank you for all your help up to this point!!!!


Sign In
Create Account


Back to top









