zipzip
asked on
How to pass 2 parameter to other form when click on image button?
<form name="form1" method="post" action="login.asp?username =request.f orm("usern ame");pass word=reque st.form("p assword") >
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
==========
login.asp
<% response.write ("request.querystring("use rname")") %>
why not working?
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
==========
login.asp
<% response.write ("request.querystring("use
why not working?
This should read like this
<%=request.querystring("us
not like
<% response.write ("request.querystring("use
Also, try like:
<% response.write (request("username")) %>
instead of
<% response.write (request.querystring("user name")) %>
as QueryString only get the variable when you use form method GET, to make it simple, use as what i stated there.
like:
request("username")
request("password")
Hope this helps
<% response.write (request("username")) %>
instead of
<% response.write (request.querystring("user
as QueryString only get the variable when you use form method GET, to make it simple, use as what i stated there.
like:
request("username")
request("password")
Hope this helps
try to do the following:
<form name="form1" method="post" action="login.asp?username =<%=reques t.form("us ername")%> ;password= <%=request .form("pas sword")%> >
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
or
<form name="form1" method="post" action="login.asp?username =<%=strUse rName%>;pa ssword=<%= strPasswor d%> >
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
<%
Dim strUserName, strPassword
strUserName=request.form(" username")
strPassword=request.form(" password")
%>
<form name="form1" method="post" action="login.asp?username
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
or
<form name="form1" method="post" action="login.asp?username
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
<%
Dim strUserName, strPassword
strUserName=request.form("
strPassword=request.form("
%>
also make sure request.querystring("usern ame") is not blank before you print it out.
Another suggestion I'd like to make is do not pass your password as a querystring. It's not secure.
You could use session objects instead
Another suggestion I'd like to make is do not pass your password as a querystring. It's not secure.
You could use session objects instead
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Like j_chakraverty said there's 2 methods to post the data and coz of that there's also 2 ways to parse the data.
Your form is using method POST and on your asp page you're trying to read the data from URL when POST method actually doesn't put the info in URL. If you want the info to be in URL then you must use method GET with your form then you can parse the data like you did with request.querystring("usern ame") etc, but i don't recommend you to keep username etc on URL so change the method to POST and use the sample which j_chakraverty gave to you.
Your form is using method POST and on your asp page you're trying to read the data from URL when POST method actually doesn't put the info in URL. If you want the info to be in URL then you must use method GET with your form then you can parse the data like you did with request.querystring("usern
just to make it simple, why don't you add a 'value' attribute to your inputs ?
<form name="form1" method="post" action="login.asp">
just one thing the correct syntax is PATH?var1=this&var2=that&. .. forget about the ';'
<input type = "text" name="username" value="<% =request.form("username"); %>">
i'm not good on asp so just check out if it echoes the needed value allright
<input type = "image" name ="submit" > :(( no good at all, see below
<input type = "image" onClick="javascript:docume nt.forms.f orm1.submi t();" src="..."> (you can add the name attribute but it's useless, you should prefferably use a IMG tag with the onclick and src attributes)
<input type="submit" src="..."> will work on some browsers but not good at all either
<a href="sendtoerrorpagesayin gthatyoune edactiveja vascript" onClick="javascript:
document.forms.form1.submi t();
this.href='#';"><img src="whatever"></a> will let you intercept non javascript-compliant surfers and will show the little hand when you put your mouse over the image !!
the best : just don't use an image for this purpoise when you don't need or just store the image as a background for a simple <input type="submit"> prefferably using CSSs. the image will only be displayed to recent browsers but older ones and javascript-forbidden clients will still be able to press the button !!
==========
login.asp
<% response.write ("request.querystring("use rname")") %>
of course you can only use this with the 'get' method
btw even with the get method you should not try to store variables in the 'action' attribute of the 'form' tag
just use <input type="hidden" name="variable" value="the_value">
try html forms in google and read a tutorial will prevent you from mixing asp and html problems too often
<form name="form1" method="post" action="login.asp">
just one thing the correct syntax is PATH?var1=this&var2=that&.
<input type = "text" name="username" value="<% =request.form("username");
i'm not good on asp so just check out if it echoes the needed value allright
<input type = "image" name ="submit" > :(( no good at all, see below
<input type = "image" onClick="javascript:docume
<input type="submit" src="..."> will work on some browsers but not good at all either
<a href="sendtoerrorpagesayin
document.forms.form1.submi
this.href='#';"><img src="whatever"></a> will let you intercept non javascript-compliant surfers and will show the little hand when you put your mouse over the image !!
the best : just don't use an image for this purpoise when you don't need or just store the image as a background for a simple <input type="submit"> prefferably using CSSs. the image will only be displayed to recent browsers but older ones and javascript-forbidden clients will still be able to press the button !!
==========
login.asp
<% response.write ("request.querystring("use
of course you can only use this with the 'get' method
btw even with the get method you should not try to store variables in the 'action' attribute of the 'form' tag
just use <input type="hidden" name="variable" value="the_value">
try html forms in google and read a tutorial will prevent you from mixing asp and html problems too often
ASKER
thanks everyone , I chose to use this method and it works perfectly :
<script langugage = "javascript">
function form_submit()
{
form1.submit();
}
</script>
<input type = "image" img src = " ../" name = submit onclick ="form_submit();"> // call submit function//
or
<input type... onclick ="javascript:form_submit() ;">
<form name="form1" method="post" action="login.asp"> //posting method//
login.asp
=====
request.form("username")
request.form("password")
and done :)
<script langugage = "javascript">
function form_submit()
{
form1.submit();
}
</script>
<input type = "image" img src = " ../" name = submit onclick ="form_submit();"> // call submit function//
or
<input type... onclick ="javascript:form_submit()
<form name="form1" method="post" action="login.asp"> //posting method//
login.asp
=====
request.form("username")
request.form("password")
and done :)
ASKER
opps, sorry
onclick = "javascript: form1.submit();"
onclick = "javascript: form1.submit();"
<input type = "text" name="username" >
<input type = "password name="password">
<input type = "image" name ="submit" >
</form>
=========
login.asp
<% Response.Write Request.QueryString("id") %>