I am new to php, mysql, I have 2 tables (table1 and table2) and wish to move data from table1 to table2 such that when a user filled in a reg_number in the form field and clicks the submit button it executes the code and opens a fresh page named "register.php.
I am having problem with this code as it fails to execute and returning blank page. Please help me in resolving this problem.
here is the form:
<form action="discharge.php" method="post">
<p>INSERT STUDENT'S REGISTRATION NUMBER
<input type="text" name="reg_number" value="">
<input type="submit" value="Submit">
here is my discharge.php code:
// username and password sent from form
$sql="INSERT INTO table2 (reg_number, surname,first_name, othername, gender)
SELECT reg_number, surname,first_name, othername, gender FROM table1 WHERE reg_number='$reg_number'";
DELETE * FROM table1 WHERE reg_number='$reg_number'";