Abeer
Abeer

Reputation: 83

No action happens when form button pressed

I have a form that contains two button but when I press on one of them nothing happen and I can't find the problem can you help me please !!

here my php code :

    <?php
    session_start(); 
    include 'connection.php';

    // in this section, I retrieve data from database and display them on table 
    // if agree button pressed do the following

 if (isset($_POST['agree']))
    {
$que="update project set status='submitted' ,projectstatus=1 where projectid=$id ";
$result3=mysql_query($que);
        if ($result3)
        {

            echo(" <script>
            alert('The project has been approved');
            </script>");

             header( "Location:unsubmited.php" );

        }
        else
        {
            echo "an error occur can't agree on this project";
        }


    }
    ?>

and this is the form :

<form action='' method='post'>
   <input type='button' name='disagree' value='disagree ' class='styled-button-11'>
   <input type='button' name='agree' value='agree' class='styled-button-11'>
   </form>

thanx ^^

Upvotes: 0

Views: 240

Answers (2)

Hitsugaya
Hitsugaya

Reputation: 79

Change your code for this, as it says andrewsi:

<form action='' method='post'>
<input type='submit' name='disagree' value='disagree ' class='styled-button-11'>
<input type='submit' name='agree' value='agree' class='styled-button-11'>
</form>

Upvotes: 2

Frank V
Frank V

Reputation: 25419

I believe this is as simple as, filling in the action='' to the page to post back to and setting the type='submit' as andrewsi suggested.

Upvotes: 1

Related Questions