admin
06-05-2003, 01:49 PM
This small script written to find and print out the last name of a user from a single text box entry. As long as the user uses one space between his/her first and last name this will work. For example if I submit Joe Schmoe, this script will return Schmoe.
<!--form entry-->
<form method="post" action="<%=script_name%>">
<input type="text" name="Name">
<input type="submit" name="submit">
</form>
<%
'dim the variables
Dim strName,strLname,intNameLength,intWhere,intEndName
Name=Request.form("Name")
'check to see if anything was submitted
if Name="" then
response.write" nothing submitted"
else
Name=Fix(Name) 'run fix function
NameLength=Len(Name) ' find length of text submitted
Where=InStr(Name,"*") 'find where in string * resides
EndName=Namelength-where 'find out how many letters are left after the *
Lname=right(Name,EndName) ' Trim the text after the *
response.write Lname ' print out result
end if
'this to find spaces and replace with *
Function FIX(NAME)
FIX=replace(Name," ", "*")
end Function
%>
By Jim Losi
<!--form entry-->
<form method="post" action="<%=script_name%>">
<input type="text" name="Name">
<input type="submit" name="submit">
</form>
<%
'dim the variables
Dim strName,strLname,intNameLength,intWhere,intEndName
Name=Request.form("Name")
'check to see if anything was submitted
if Name="" then
response.write" nothing submitted"
else
Name=Fix(Name) 'run fix function
NameLength=Len(Name) ' find length of text submitted
Where=InStr(Name,"*") 'find where in string * resides
EndName=Namelength-where 'find out how many letters are left after the *
Lname=right(Name,EndName) ' Trim the text after the *
response.write Lname ' print out result
end if
'this to find spaces and replace with *
Function FIX(NAME)
FIX=replace(Name," ", "*")
end Function
%>
By Jim Losi