0

I am trying to create a simple form on one of my wordpress pages. The code used is as basic as it can be, namely the following:

<form action="" method="GET">
        <select>
            <option value="test" >test</option>

        </select>   
        <input type="submit" value="search">
    </form> 

the problem is, every time i click the search button, i get redirected to the homepage! Shouldn't this small little form be redirected to the page containing the form, since action is empty?

2
  • The URL you see in the address bar is the homepage URL?
    – Milo
    Commented Sep 9, 2017 at 14:50
  • yes, it was the homepage url, even though that is not where the form originates.
    – user127554
    Commented Sep 10, 2017 at 13:55

2 Answers 2

1

Try

<form action="#" method="GET">

(Although I prefer the POST method.)

1
  • i need those variables to be visible so it makes (in my opinion) for a nicer looking url.
    – user127554
    Commented Sep 10, 2017 at 13:55
0

Alright guys, believe it or not, but the underlying problem had to do with permissions on the root folder!

the aforementioned <form action="#" method="GET"> didn't work either, so i digged a little deeper, and i found out certain pages couldn't be opened either.

Why this causes every single simple form to be redirected to home is beyond me, but the solution was to change the permissions of the .htaccess file (which WAS present by the way), to 775.

Out of caution i also changed the root folder permission to 775, and all is well now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.