Inserting data into multiple tables For my system, students are required to create a user account by completing a registration form (personal, contact and course details; also username and password).

I need to collect registration data through a single form and insert the collected data into two related tables on my database (all student details in student table and login details in users table).

How best can I code this in php?
Use mysqli or PDO libraries for PHP, do not use mysql, as it is deprecated
Use prepared statements: they are cleaner, less prone to SQL injection and, in some cases, faster to execute
Use exceptions to capture errors throughout your code -query fails, query gets killed, database crashes, unable to connect, ...
If you feel intimidated by SQL, an ORM can help you build your queries, but they are not without issues
Students' id should have a foreign key referencing user_id, assuming you want a 1:1 relationship. To use foreign keys on MySQL you will want to use InnoDB stored engine.
You cannot insert to two tables with a single statement, so you should use transactions. Start a transaction before inserting to the first table, then insert to the second one, then COMMIT the changes. That way, either the two inserts succeed or both fail. Transactions also require InnoDB.
student_id/user_id are probably going to be unique arbitrary keys. You can use the auto_increment property for that column and do:

START TRANSACTION;
INSERT INTO student (last_name, fist_name, ...) VALUES ('Crespo', 'Jaime', ...);
INSERT INTO users VALUES (last_insert_id(), 'jynus', 'hashedpassword', 'student');
COMMIT;