Expand|Select|Wrap|Line Numbers
- <?php
- $student_name=$_POST[student_name];
- $year_of_study=$_POST[year_of_study];
- $email=$_POST[email];
- $reg_no=$_POST[reg_no];
- $password+=$_POST[password];
- try{
- $host="localhost";
- $username="root";
- $password="";
- $database="registration";
- $dsn="mysqlhost=$host,$dbname=$database";
- $conn=new PDO($dsn,$username,$password);
- $conn->setAttribute(PDO:ATTR_ERRMODE,PDO:ERRMODE_EXCEPTION);
- $SQL="INSERT INTO student registration("student_name,reg_no,year_of_study,password"")
- VALUES($student_name,$reg_no,$year_of_study,$password);
- $sql="select*FROM userdata";
- $userdata=$conn_query($sql);
- echo'<table>;
- echo'<tr>;
- echo'<th>student_name</th> <th>reg_no<?th
- <th>email</th> <th>year_of_study</th> <th>password</th>;
- echo'<tr>;
- foreach($userdata as $userdata)
- {
- echo'<tr>;
- echo'<td>$userprofile[student_name]</td>;
- echo'<td>$userprofilep[email]</td>;
- echo'<td>userprofile[reg-no]</td>;
- echo'<td>userprofile[year_of_study]</td>
- echo'<td>userprofile[password]</td>
- echo'</tr>
- }
- echo'</table>;
- $conn=null;}
- catch(PDOException $e){$conn=null;
- exit("connection failed $e->getmessage0");
- }
- <?php reguire_once_connection.php?> <?php
- $process_form.html?>