将结果提交到url末尾,而不是添加index.php

将结果提交到url末尾,而不是添加index.php,php,html,Php,Html,我基本上喜欢下面的提交将文本放在url的末尾 我想要的例子 --显然没有()这个词 我不想要的例子-- 搜索名称 我想通过html或php来解决这一问题,只要它将请求提交到以下地址:) 提前感谢。使用POST方法而不是GET <form action="" method="POST"> <fieldset> search name <br> <input type="text" name="search" value="name"> &l

我基本上喜欢下面的提交将文本放在url的末尾

我想要的例子

--显然没有()这个词

我不想要的例子--


搜索名称


我想通过html或php来解决这一问题,只要它将请求提交到以下地址:)


提前感谢。

使用POST方法而不是GET

<form action="" method="POST">
<fieldset>
 search name
<br>
<input type="text" name="search" value="name">
<br>
<input type="submit" value="Submit"></fieldset>
</form>

搜索名称



简而言之,您可以执行以下操作:

<?php 

    // Get posted text
    $text = strtolower(mysql_real_escape_string($_POST['text']));

    // Do some cleanup here

    // Redirect to page
    if ($text != ''){
        header( 'Location: http://www.example.com/' . $text );
    }

    // HTML output below (not before)

?>    
<form method="post" action="">
    <fieldset>
        Search name<br />
        <input type="text" name="text" /><br />
        <input type="submit" value="Submit" />
    </fieldset>
</form>

搜索名称


似乎没有在文章结尾添加任何内容url@DarrenBrinx您可以包含部分PHP代码吗?因此,我们可以查看PHP部分中的错误,重复的可能重复???lol不,我不想重写url,我想让它正确地将文本发布到url>…不发布任何内容
<?php 

    // Get posted text
    $text = strtolower(mysql_real_escape_string($_POST['text']));

    // Do some cleanup here

    // Redirect to page
    if ($text != ''){
        header( 'Location: http://www.example.com/' . $text );
    }

    // HTML output below (not before)

?>    
<form method="post" action="">
    <fieldset>
        Search name<br />
        <input type="text" name="text" /><br />
        <input type="submit" value="Submit" />
    </fieldset>
</form>