Hello,
I have been trying to make the value of form successfully except the drop down menu. Also is it possible to clear out the content after the data has been inserted to the database?
Here is the code:
[php]
<?php $errorMessage = ''; if (isset($_POST['submit'])){ include 'db.php';//Connect to database $title=$_POST['title'] ; $author= $_POST['author'] ; $name=$_POST['name'] ; $copy=$_POST['copy'] ; $title_search = mysql_query("SELECT Title FROM books WHERE Title='$title' AND Author='$author'"); if(mysql_num_rows($title_search) != 0) { $errorMessage = 'Record Already Exist!'; }else { mysql_query("INSERT INTO `books`(Title, Author, PublisherName, CopyrightYear) VALUES ('$title', '$author', '$name', '$copy')"); } } mysql_close($conn); ?> Books <?php if ($errorMessage != ''){echo $errorMessage;} ?>Title: | ||||||||
Author | ||||||||
Publisher Name |
- Select -
<?php
include 'db.php';
[/php] Also I don’t know why the copyright is not inserted in the database. |