0

//line 2 is at the begining of the if statement

 <?php
        if (isset($_POST = 'submitted')){
//code here
  }
    ?>
Puva
  • 11
  • 2

1 Answers1

1

Obvioulsy what you need is

if (isset($_POST['submitted'])) {
    // code here
}

isset($_POST['submitted']) checks if key 'submitted' isset in your $_POST array.

In your code

if (isset($_POST = 'submitted')) {

isset checks the result of assigning value 'submitted' to $_POST. But the result of assignment is some value, and this value can not be checked if it is set. As a side effect your $_POST is overwritten and you lose all your data inside it.

u_mulder
  • 54,101
  • 5
  • 48
  • 64
  • If answer helps you - you can accept it. More here https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – u_mulder Mar 08 '17 at 19:34