How to used ASP & Multiple Input Text Field/Textbox This the tutorial/example a scripts how to use ASP & Multiple Input Text Field/Textbox
ShotDev Focus:
- ASP & Multiple Input Text Field/Textbox
Example 1 (Static Textbox)
asp_multiple_textbox1.asp
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="asp_multiple_textbox2.asp" method="post" name="form1"> <input type="text" name="txtSiteName"><br> <input type="text" name="txtSiteName"><br> <input type="text" name="txtSiteName"><br> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
asp_multiple_textbox2.asp
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim i i = 0 For Each txtVol in Request.Form("txtSiteName") Response.write "txtSiteName " & i & " = " & txtVol & "<br>" i = i + 1 Next %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_multiple_textbox1.asp
Screenshot
.
Example 2 (Dynamic Create Textbox)
asp_multiple_textbox3.asp
<html> <head> <title>ShotDev.Com Tutorial</title> <script language="javascript"> function fncCreateElement(){ var mySpan = document.getElementById('mySpan'); var myElement1 = document.createElement('input'); myElement1.setAttribute('type',"text"); myElement1.setAttribute('name',"txtSiteName"); mySpan.appendChild(myElement1); var myElement2 = document.createElement('<br>'); mySpan.appendChild(myElement2); } </script> </head> <body> <form action="asp_multiple_textbox4.asp" method="post" name="form1"> <input type="text" name="txtSiteName"> <input name="btnButton" type="button" value="+" onClick="JavaScript:fncCreateElement();"><br> <span id="mySpan"></span> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
asp_multiple_textbox4.asp
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim i i = 0 For Each txtVol in Request.Form("txtSiteName") Response.write "txtSiteName " & i & " = " & txtVol & "<br>" i = i + 1 Next %> </body> </html>
Create a php file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_multiple_textbox3.asp
Screenshot