通过URL中的用户输入提交表单后重定向 [英] Redirecting after form submission with user input in the URL

查看:111
本文介绍了通过URL中的用户输入提交表单后重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



类似这样的东西(但是那样的话工作):)

 < form action =?????方法= ????? > 

数字:< input type =textname =url1value =>< br>

< input type =submitname =submitvalue =Goto URL>
< / form>

当提交被按下时,我需要它转到 http://somewhere.com?url=VALUEHERE



有什么想法?

解决方案使用 method =GET将变量放入url中:

 < form action =http://somewhere.com/method =GET> 
号码:< input type =textname =urlvalue =/>< br />

< input type =submitname =submitvalue =Goto URL/>
< / form>

发布此表单将发送至 http://somewhere.com/?url=USER_INPUT_URL


I need to have a form that when filled out will create a variable and then goto a url with that variable in the url.

Something like this (but that works) :)

<form action="?????" method="?????">

Number: <input type="text" name="url1" value=""><br>

<input type="submit" name="submit" value="Goto URL">
</form>

When the submit is pressed I need it to goto http://somewhere.com?url=VALUEHERE

Any ideas?

解决方案

Use method="GET" to place the variables in the url:

<form action="http://somewhere.com/" method="GET">
    Number: <input type="text" name="url" value="" /><br />

    <input type="submit" name="submit" value="Goto URL" />
</form>

Posting this form will go to http://somewhere.com/?url=USER_INPUT_URL

这篇关于通过URL中的用户输入提交表单后重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆