if(isset($_POST['submit'])){ } NOT WORKING on submit button <p>I have a problem where when ever I load my page it says that the form is done even when I don't press submit here is the code - </p> <pre><code>&lt;?php $db_host = 'localhost'; $db_name = 'info';enter code here $db_user = 'root'; $db_password = ''; try { $db = new PDO('mysql:host=' . $db_host . ';dbname=' . $db_name, $db_user, $db_password); echo "connected&lt;br&gt;&lt;br&gt;"; } catch (PDOException $e) { echo "Error: " . $e-&gt;getMessage(); die(); } if(isset($_POST['submit'])){ $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $info = $_POST['info']; $date = $_POST['date']; $sql = "INSERT INTO info (name, phone, email, info, date)"; $sql .= " VALUES (:name, :phone, :email, :info, :date)"; $query = $db-&gt;prepare($sql); $query-&gt;execute(array( ':name' =&gt; $name, ':phone' =&gt; $phone, ':email' =&gt; $email, ':info' =&gt; $info, ':date' =&gt; $date )); echo "done&lt;br&gt;"; } ?&gt; </code></pre>