0

Here is my code, I want add.php to open in the current tab not open a new window all together.

<input type="submit" class="btn" value="Add Record" onclick="addrecord()">
          <script>
               function addrecord() {
                    window.open("add.php", "Add Record", "_self");
               }
          </script>

Venkat.R
  • 7,420
  • 5
  • 42
  • 63
Tye Lucas
  • 107
  • 1
  • 1
  • 9

1 Answers1

1

For your case, you should redirect the page not opening a new window. Try below snippet.

<input type="submit" class="btn" value="Add Record" onclick="addrecord()">

    <script type="text/javascript">
                   function addrecord() {
                        window.location = "http://www.google.com";
                   }
    </script>
Venkat.R
  • 7,420
  • 5
  • 42
  • 63