如何将数据从文本框发布到URL [英] How can I post data from textbox to URL
本文介绍了如何将数据从文本框发布到URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想点击按钮创建时,URL变成这样:
http:/ loclhost / create_profil / firstname = Nom&lastname = prenom
nom = textBox.Text
prenom = textBox.Text
解决方案
你的查询字符串中缺少(?)
如果我们假设您使用的是asp.net c#并希望使用参数重定向
String my link = create_profil.aspx?firstname = + nom + & lastname = + prenom;
Response.Redirect(mylink);
希望这会有所帮助!
如果我们假设您使用的是ASP。 net和textbox包含在表单标记中,然后在表单标记上设置method = get,然后按照预期将值作为查询字符串发布。
< 表格 < span class =code-attribute>方法 = get >
< / form > 跨度>
Hello there,
I want when I click on button create, the URL became like this :
http:/loclhost/create_profil/firstname=Nom&lastname=prenom
nom=textBox.Text
prenom=textBox.Text
解决方案
you are missing (?) in your query string
if we assume you are using asp.net c# and want to redirect with parameters
String my link="create_profil.aspx?firstname=" +nom +"&lastname=" +prenom ; Response.Redirect(mylink);
hope this helps!
If we assume that you are using ASP.Net and textbox are enclosed in the form tag then set the method=get on the form tag then values are posted as query string as you expected.
<form method="get"> </form>
这篇关于如何将数据从文本框发布到URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文