I have a problem in my php form : isbn number is a GET variable . Thus view.php opens in a URL like : localhost/../view.php?isbn=0810982463. Whereas I want the url structure to be like localhost/..../0810982463. I know it can be done by using the Post method, Can it be done using the GET method ?

<form action="view.php" method="get">

  <p class="name">
            <label for="isbn">ISBN No. &nbsp;</label>
    <input type="text" name="isbn" id="isbn" value="0199555311">
        </p>
        <p class="submit">
          <input type="submit" value="Search Book" />
        </p>
</form>
有帮助吗?

解决方案

No matter what, the GET form submission will be in a query string format, just look at Google's form submission, or even Stack Overflow's own searching. This is the way things have been standardized across browsers.

If you want it to look pretty, after the submission, you'll need to redirect the user to a pretty URL.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top