表单提交URL格式 [英] Form Submit URL Formatting
问题描述
我有一个表单提交到URLsignup.php?username = xx,其中xx是一个输入字段。而不是这个,我想知道如果我能得到它去以下url注册/ xx,其中XX是从输入字段中获取。
你需要使用Javascript和某种类型的.htaccess。但为什么不使用 POST
而不是 GET
?
我不希望 singup?username = sawny& password = 1234
在我的历史记录中。
编辑:
我做了这样的事情:
$(document).ready(function(){
$(submit [name ='foo'])。live('submit',function(){
var usr = $(form input [name ='user'])。val();
$(form input [name ='user'])。remove(); //否则将会是singup / usr?user =
$(form [name ='bar'])。attr(action,singup /+ usr);
}) ;
});
,然后将正则表达式@zero发布在.htaccess文件中。
I have a form which when submitted goes to the url "signup.php?username=xx" where xx is an input field. Instead of this I was wondering if I could get it to go to the following url "signup/xx" where xx is taken from the input field.
You need to use Javascript and some type of .htaccess for that. But why don't you use POST
instead of GET
?
I don't want singup?username=sawny&password=1234
in my history.
EDIT:
I had done something like this:
$(document).ready(function() {
$("submit[name='foo']").live('submit', function() {
var usr = $("form input[name='user']").val();
$("form input[name='user']").remove(); //Else it will be singup/usr?user=
$("form[name='bar']").attr("action", "singup/"+ usr);
});
});
and then the regexp @zero posted in a .htaccess file.
这篇关于表单提交URL格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!