Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 14th, 2004, 09:40 AM
axe_man axe_man is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 31 axe_man User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 42 m 42 sec
Reputation Power: 5
Question Function from a form

As an example i want to run a function from a submit button within a form. Here is the code that doesn't work

Code:
 
<%@LANGUAGE="VBSCRIPT"%>
<% option explicit %>
<%
Function FormGetName()
 Dim strName
 strName = request.form("txtName")
 response.write("strName")

End function
%>
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 11px;
}
-->
</style>
</head>
<body>
<form action="FormGetName()" method="post">
  <table width="275" border="1" cellpadding="3" cellspacing="0" bordercolor="#990000">
	<tr>
	  <td width="83" bgcolor="#FFFFCE"><span class="style1">Your Name:</span></td>
	  <td width="107" bgcolor="#FFFFCE"><input name="txtName" type="text" id="txtName"></td>
	</tr>
	<tr bgcolor="#FFFFCE">
	  <td colspan="2"><div align="center">
		<input type="submit" name="Submit" value="Submit">
	  </div></td>
	</tr>
  </table> 
</form>
 
</body>
</html>
 


I want to avoid splitting the code onto two seperate ASP pages.

Thanks for any help

Reply With Quote
  #2  
Old April 14th, 2004, 11:21 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 58 m 22 sec
Reputation Power: 469
try this. Let's assume the pages name is page1.asp
Code:
<%
If(Request.Form("Submit") <> "") Then
   	response.write(Request.Form("txtName"))
End If
%>
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 11px;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="test6.asp">
  <table width="275" border="1" cellpadding="3" cellspacing="0" bordercolor="#990000">
	<tr>
	  <td width="83" bgcolor="#FFFFCE"><span class="style1">Your Name:</span></td>
	  <td width="107" bgcolor="#FFFFCE"><input name="txtName" type="text" id="txtName"></td>
	</tr>
	<tr bgcolor="#FFFFCE">
	  <td colspan="2"><div align="center">
		<input type="submit" name="Submit" value="Submit">
	  </div></td>
	</tr>
  </table> 
</form>
 
</body>
</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Function from a form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT