I have a registration form in html and php code that connects to the database. Now, if the registration was successful and added to the database, how can I warn the user that he is successful with a pop-up window?
The html code is just simple form codes, so the php code is:
<?php if(isset($_POST['submit'])){ $fname = $_POST['firstname']; $lname = $_POST['lastname']; $mname = $_POST['middlename']; $birthday = $_POST['year'] . '/' . $_POST['month'] . '/' . $_POST['day']; $sex = $_POST['sex']; $age = $_POST['age']; $address = $_POST['address']; $telephone = $_POST['telephone']; $occupation = $_POST['occupation']; $telephone = $_POST['telephone']; $cfname = $_POST['contactfirstname']; $clname = $_POST['contactlastname']; mysql_connect('localhost', 'root', ''); mysql_select_db('HMIS'); $query = "INSERT INTO `patientrecords` VALUES('','$lname','$fname','$mname','$birthday','$sex','$address','$telephone','$occupation','$clname','$cfname')"; if(mysql_query($query)){ echo "Registered"; }else{ echo "Error!". mysql_error(); } } ?>
I can make a javascript warning window only when I click on a specific button. But in PHP code you donβt need a button .. so .. how do you do it?
source share