Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does form action do - submitting data from a form?

Status
Not open for further replies.

fmasin

Technical User
May 3, 2002
163
0
0
GB
Hi,

Could somebody please explain what the following code does and how it is supposed to work...
==========================================================

<form method=post action=" " name="Clinicalform" onSubmit="return checkFields()">

<input type=hidden name=to value="">
<input type=hidden name=subject value="Your query/application details">

<pre>
Your Name: <input type=text name="name">
Your Email: <input type=text name="email">
Date of Birth: <input type=text name="Date_of_Birth">

Comments?

<textarea name="comments" wrap="virtual" rows="7" cols="45"></Textarea>

<input type=submit value="Submit Form!">

[Click the submit button twice to see the script in action ]
</pre>
</form>

====================================================

Thanks and regards,

Francis
 
Perhaps to put my question better - how do I submit the contents of a form? what sort of things do I need to specify?

Thanks and regards,

Francis
 
ok try this simple code...

formpage.asp
Code:
<html>
<body>
<form method="post" action="myactionpage.asp">
<input type="text" name="myname">
<input type="submit" value="submit">
</form>
</body>
</html>

in the above form we have one text field called myname and one submit button to submit the form..when i say to submit the form it means that when we click the submit buttom the form gets processed and sends/posts information to the action page as specified in the form tags...as you can see we specified the action page as myactionpage.asp...

now lets see the code for myactionpage.asp

Code:
<%
Response.Write "My Name is: " & request.form("myname")
%>

as you can see we can access whatever entered in the form using request.form("formfieldname")...

hope this helps you understand the basics...above is just a simple sample code...please refer
to learn some basics...

-DNG
 
DNG,

Thanks for this. I have tested the code but when I submit the text input nothing appears, it simply does not go anywhere...the myactionpage.asp form appears but it is blank...

How do I get the details that I submit from a form to go somewhere so I can view them?

Thanks and regards,

Francis
 
i am surprised that you are getting the blank page...

are you sure you dont have any typos and both your form and action pages are in the same folder and you have put them in your folder on the server...

-DNG
 
Yes DNG,

It works but how would I hide the information submitted from the sender of the information - so that it's only me that can view it....and perhaps redirect them to some other page...


Thanks and regards,

Francis
 
I think the mising piece here is the unposted javascript. Right now that action is not set. Action is what specifies what page the form is posted to (blank action reposts to same location? can't remember).
However, in this case you have a javascript validation function that is being called for the onSubmit. I wouldn't be surprised if that function set an action or did something else important.

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top