• PHP Project: Library Management System on PHP and SQL

    ShikhaTan Member

    Am doing a project on Library Management System on PHP and SQL.
    I have successfully done my pages for login, add book and delete book.

    I just don’t know how to put validation.

    Can someone please help me?

    Thanks.

    Login.PHP

    
          
          

    Register

    Username:

    Password:

    addbook.php

    
    
    
    
       

    Add a new book






    Back

    alert('No Title was entered was entered.
    Please include a title!');"; } elseif (empty($bauthor)) { echo "
    "; } $insertquery = "INSERT INTO book (b_id, b_title, b_author, f_id, status ) VALUES($bid,'$btitle','$bauthor',$fac,'$bstatus')"; $outcome = mysqli_query($dbconn, $insertquery); if($outcome) header('Location:admin.php'); else echo 'Book not Added Please Try Again!'; } ?>

    deletebook.php

    
    
       
       

    Delete Book

  • codewithc
    CWC Keymaster

    Have a read through this, it may help:
    http://phpmaster.com/form-validation-with-php

  • codewithc
    CWC Keymaster

    I very rarely give complete written solutions for people requiring help here. Other people can do, but I am against it, you learn a lot more by doing it yourself than copying/pasting completed code; I used to do that and I didn’t learn very much, once I started doing it myself I learnt a lot more. No pain no gain as the saying goes.

    Anyway, enough of that, can you paste your source/errors that you are getting? We can work through them and iron them out.

    Also, I can’t write your validation as it depends what validation you want to do.

    Try providing the following student name:

    '; drop table student;

    You should really code this as

    $query = sprintf("SELECT * FROM  student WHERE s_username='%s' AND s_password='%s'",
    mysql_real_escape_string($uname), mysql_real_escape_string($upass));
    
Viewing 2 reply threads
  • You must be logged in to reply to this topic.
en_USEnglish