how to call php function from submit button?

php

Solution

<?php
if (isset($_REQUEST['insert'])) {
    insert();
} elseif (isset($_REQUEST['select'])) {
    select();
}

Your code is calling `insert()` even if no button is clicked, which will happen when the page is first displayed.

Problem

my filename is contacts.php that have two submit buttons;i want that if insert button is pressed insert function is called and if select is pressed select is called.i have written following code: ``` //contacts.php <?php if(isset($_REQUEST['select'])) { select(); } else { insert(); } ?> <html> <body> <form action="contacts.php"> <input type="text" name="txt"/> <input type="submit" name="insert" value="insert" /> <input type="submit" name="select" value="select"/> </form> <?php function select() { //do something } function insert() { //do something } ?> ``` but it is not working .please help

Original source