How to get custom URL structure after passing variable through GET method?

StackOverflow https://stackoverflow.com/questions/16514088

  •  21-04-2022
  •  | 
  •  

Вопрос

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