0

I have a file HTML with a lot of buttons, when I click a button, the action in the HTML is a reference to a php file. What can I do for don't open a new the page, I mean run the PHP file without opening it.

This is the form in my HTML

<form action="Controlador.php" method="POST">
    <p>He querido irme a dormir a las 8:00 en viernes</p>
    <input type="submit" class="button" name="1" value="Vota" />
    <br>
</form>
Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247
Dinorah Tovar
  • 488
  • 2
  • 15
  • Send the request via ajax. https://learn.jquery.com/ajax/ – chris85 Jul 15 '15 at 23:00
  • You should take a look at [AJAX](https://en.wikipedia.org/wiki/Ajax_%28programming%29) –  Jul 15 '15 at 23:00
  • You can't do this purely in php, as php runs server-side. You'd need to use a javascript/AJAX solution – nomistic Jul 15 '15 at 23:00
  • possible duplicate of [Submit form without page reloading](http://stackoverflow.com/questions/2866063/submit-form-without-page-reloading) –  Jul 15 '15 at 23:05

1 Answers1

1

see this How do I make a PHP form that submits to self?

do not define separate action page, use same form page for action

Community
  • 1
  • 1
Faisal
  • 1,907
  • 1
  • 22
  • 29