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]')");
3 Antworten
+ 1
I CAN'T READ YOUR CODE WELL
MAKE IT CLEAR
+ 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 : )
0
$_POST[booksname] doesn't exist