-2

I have just created my first website with php and bootstrap and have run into a problem when a bootstrap form is submitted.

What happens is if you start on the main url page and enter a url into the input form it will redirect to the the index.php.

The code i used for the input is

<form class="form-horizontal" role="form" method="post" action="index.php">

Is there anyway to use a .htaccess etc to redirect it back? or is it normal that after a form is submitted it then attaches /index.php to the url?

zeddex
  • 1,260
  • 5
  • 21
  • 38
  • 1
    Well, your form action submits to index.php, so... – Epodax Dec 02 '15 at 12:14
  • 1
    *"to redirect it back?"* - redirect back to what, your homepage? – Funk Forty Niner Dec 02 '15 at 12:16
  • I have fixed the problem now, i have to wait 10 mins for some reason but then i can accept the answer from Alex, yeah i wanted it to redirect to the homepage which it now does after changing the html. – zeddex Dec 02 '15 at 12:22

1 Answers1

2

just remove action="index.php"

Alex Babak
  • 489
  • 3
  • 15
  • 2
    @zeddex better think about someone hitting the refresh button. ah, didn't think about that eh? ;-) try it yourself and see what it does. Fill the input, hit the submit then hit F5/refresh after that. – Funk Forty Niner Dec 02 '15 at 12:19
  • It gives a message box in chrome, any idea how i could fix that? – zeddex Dec 02 '15 at 20:39
  • 1. that's totally OK, but if you really need to "solve" that -- redirect to other result page without POST request. http://stackoverflow.com/questions/6320113/how-to-prevent-form-resubmission-when-page-is-refreshed-via-php – Alex Babak Dec 02 '15 at 21:28