0

having problem in php "notice: Undefined index: booksname"

if(isset($_POST['submit2'])) { mysqli_query($conn,"insert into issue_book values('','$_SESSION[student_no]','$_POST[studentname]','$_POST[semester]','$_POST[contact]','$_POST[email]','$_POST[booksname]','$_POST[bookissuedate]','','$_SESSION[username]')");

26th Aug 2018, 4:50 PM
Phoebe Gaufo
Phoebe Gaufo - avatar
3 Réponses
+ 1
I CAN'T READ YOUR CODE WELL MAKE IT CLEAR
26th Aug 2018, 6:21 PM
Femi
Femi - avatar
+ 1
When we refer to an element in an associative array we use the element's key, in the SQL query I see you forgot this; // Should be: $_SESSION['student_no'] // Instead of: // $_SESSION[student_no] // Should be: $_POST['studentname'] // Instead of: // $_POST[studentname] and so on ... I guess you will be better off storing the values into temporary variables, rather than directly using global array elements in SQL queries, not to mention possibility of mess from missing or mis-placed quotes : )
27th Aug 2018, 3:05 AM
Ipang
0
$_POST[booksname] doesn't exist
26th Aug 2018, 7:55 PM
Αητοιπe
Αητοιπe - avatar