Hello Friends, I had designed the page in frontpage it is the code. I am new in coding database Please can someone tell me how to link this code to database. It is page code for entering the data same type page is for getting output. I am using tables to see all the record in a panel page. <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 2</title> </head> <body> <p></p> <p></p> <p> <input type="file" name="F1" size="20"> </p> <p> <input type="reset" value="Reset" name="B2"><input type="submit" value="Submit" name="B1"></p> <p><font face="Algerian"> </font></p> <p><font face="Algerian"> Registration number* <input type="text" name="T16" size="7"> Degree status</font></p> <p><font face="Algerian"> NAME *</font><input type="text" name="T17" size="20"><font face="Algerian"> </font> <font face="Algerian"> NAME OF INSTITUTE; YEAR OF PASSING </font></p> <p><font face="Algerian"> SEX * </font><input type="checkbox" name="C1" value="ON"><font face="Algerian">MALE; </font><input type="checkbox" name="C2" value="ON"><font face="Algerian">FEMALE; degree* </font><select size="1" name="D1"></select> <select size="1" name="D2"></select> <font face="Algerian"> <input type="text" name="T18" size="20"> <input type="text" name="T19" size="20"> </font></p> <p><font face="Algerian"> AGE</font> * <font face="Algerian"><input type="text" name="T20" size="5"> </font><input type="checkbox" name="C3" value="ON"><font face="Algerian"> M.D.; <input type="text" name="T22" size="20"> <input type="text" name="T23" size="20"></font></p> <p><font face="Algerian"> DATE OF BIRTH* <input type="text" name="T43" size="3">DD <input type="text" name="T44" size="3">MM <input type="text" name="T45" size="3">YY; </font><input type="checkbox" name="C4" value="ON"> <font face="Algerian">P.H.D; <input type="text" name="T25" size="20"> <input type="text" name="T26" size="20"></font></p> <p><font face="Algerian"> FATHER'S NAME* <input type="text" name="T27" size="20"> OTHERS; <input type="text" name="T28" size="20"> <input type="text" name="T29" size="20"></font></p> <p><font face="Algerian"> PHONE NUMBER* <input type="text" name="T30" size="4"> - <input type="text" name="T42" size="13"></font></p> <p><font face="Algerian"> MOBILE NUMBER <input type="text" name="T47" size="20"> </font></p> <p><font face="Algerian"> ADDRESS1* <input type="text" name="T31" size="20"></font></p> <p><font face="Algerian"> ADDRESS2; <input type="text" name="T32" size="20"></font></p> <p><font face="Algerian"> CITY *; <input type="text" name="T33" REGISTRATION STATUS</font></p> <p><font face="Algerian"> STATE*; <input type="text" name="T34" size="20"> </font> <font face="Algerian"> DATE OF APPLYING; DATE OF GRANTING</font></p> <p><font face="Algerian"> COUNTRY *; <input type="text" name="T35" size="20"> CURRENT STATUS* </font><select size="1" name="D3"></select><font face="Algerian"> <input type="text" name="T36" size="3">DD <input type="text" name="T37" size="3"> MM<input type="text" name="T38" size="3"> YY <input type="text" name="T39" size="3">DD <input type="text" name="T40" size="3">MM<input type="text" name="T49" size="3">YY</font></p> <p><font face="Algerian"> PLACE OF PRACTICE* <input type="text" name="T46" size="20"></font></p> <p><font face="Algerian"> </font></p> <p><font face="Algerian"> REMARK <input type="text" name="T48" size="66"></font></p> <p> </p> <p><font face="Algerian"> </font></p> <p> </p> </body> </html> Code (markup): It is the database structure CREATE TABLE country ( id int(10) unsigned NOT NULL auto_increment, name varchar(50) default NULL, code varchar(4) default NULL, PRIMARY KEY (id) ) ENGINE=InnoDB; CREATE TABLE registration ( id int(10) unsigned NOT NULL auto_increment, registration_number int(10) unsigned default NULL, name varchar(100) default NULL, country_id int(10) unsigned default NULL, state_id int(10) unsigned default NULL, city varchar(50) default NULL, address varchar(75) default NULL, practice_place varchar(155) default NULL, fathers_name varchar(100) default NULL, birthday date default NULL, age tinyint(3) unsigned default NULL, degree enum('bams','bums','md','phd') default NULL, institution varchar(100) default NULL, passing_year int(11) default NULL, registration_status enum('granted','pending','expired') default NULL, photo longblob, grant_start date default NULL, grant_end date default NULL, PRIMARY KEY (id), KEY country (country_id,state_id) ) ENGINE=InnoDB; CREATE TABLE state ( id int(10) unsigned NOT NULL auto_increment, country_id int(10) unsigned NOT NULL, name varchar(50) default NULL, PRIMARY KEY (id), KEY country_id (country_id) ) ENGINE=InnoDB; ALTER TABLE state ADD CONSTRAINT state_ibfk_1 FOREIGN KEY (country_id) REFERENCES country (id) ON DELETE CASCADE ON UPDATE NO ACTION; Code (markup):
Well, from what I can see you obviously have the html output sent to the client browser done and the sql tables setup. You "link" the code to the database via SQL queries (depends what sort of database you're using). You can use a server-side scripting language like PHP to send the information submitted via a form to the database. I hope that helps a bit.
sql is the database you have, already made i guess. What you need is php the script where the data is sent from the html to the php script maybe data.php, and then the codes in php access your database. so it's html --> php --> database, you got the html done, some modification needed to point to the php file and then you need a php file which you have to code. Now to help me, can you tell me why you have 3 tables and why state has to be in a separate table. I dont see the problem with one table, maybe there could be some, have to test first I want to help you but lets talk about it a bit first Here is an example of html form to php $name = trim($_POST['txtName']); PHP: The $name is the php variable for name and txtname is the name of your textbox name in html. Next is the code where php data is inserted into database $query = "INSERT INTO databasetablename (name, etc etc, etc etc,) " . "VALUES ('$name',)"; PHP: if you can handle php, the majority of your code will be like this