0

when i insert data in mysql, this error are generated.

Notice: Undefined index: enroll in G:\xampp\htdocs\tg\1stSubmit.php on line 10

enroll is a defined in <input type="text" name="enroll"> and on submit page declare :

$a =  $POST['enroll'];
$sql="INSERT INTO student (e_no,f_name) VALUES ('$a','$b')";
Raptor
  • 53,206
  • 45
  • 230
  • 366

2 Answers2

1

I guess it's a typo,

$a =  $_POST['enroll']; //you missed "_" should be _POST

And always check if post variable really exists or not,

$a =  isset($_POST['enroll']) ? $_POST['enroll'] : ""; 

Reference.

Warning: Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO, or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Rikesh
  • 26,156
  • 14
  • 79
  • 87
1

use

$a = $_POST['enroll'];

instead of

$a = $POST['enroll'];
Deepu Sasidharan
  • 5,193
  • 10
  • 40
  • 97