I am new to php, mysql, I have 2 tables (table1 and table2) and wish to move data from table1 to table2 with after inserting the required parameter in the form field and clicking submit button in form. It then opens a fresh page named "register.php after the code has been executed.
I am having problem with this code as it fails to execute. 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'";