I am making feedback page, but it is producing some errors. i don't understand what is wrong. Please help me figure out where i am doing wrong. when i submit the form the errors goes away and produce right result,but when i refresh the page it produces same errors again
<?php
$name = $_POST['name']; // error undefined index name
$suggestion = $_POST['suggest']; // error undefined index suggest
$opinion = $_POST['opinion']; // error undefined index opinion
$submit = $_POST['submit']; // error undefined index submit
if(isset($submit)){
$sql= mysqli_query($con,"insert into feedback (name,suggestion,opinion) values ('$name','$suggestion','$opinion')");
if($sql==true){?>
<div class="alert alert-info">
Thankyou for your suggestions. we will notify the admins.
</div>
<?php
}
}
?>
<body>
<div class="feedback">
<form action="feedback.php" method="post">
<h1> Help us improve our website</h1>
<h2>Please drop your suggestion below</h2>
<div class="form-group">
<label >Your Name:</label>
<input type="text" class="form-control" name="name" required>
</div>
<div class="form-group">
<label for="comment">Your suggestion</label>
<textarea class="form-control" name="suggest" rows="5" id="comment" required ></textarea>
</div>
<p>Were you satisfy with this website?</p>
<label class="checkbox-inline">
<input type="checkbox" name="opinion"value="1"> yes
</label>
<label class="checkbox-inline">
<input type="checkbox" name="opinion" value="2"> no
</label>
<label class="checkbox-inline">
<input type="checkbox" name="opinion" value="3"> may be
</label>
<br /><br />
<button type="submit" name="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</body>