0% found this document useful (0 votes)
7 views1 page

Print 1

This document contains PHP code for a web form that allows users to insert student data into a MySQL database. The form collects three fields: roll number, name, and course, and submits the data to the 'student' table in the 'cmri' database. The code establishes a database connection and executes an insert query upon form submission.

Uploaded by

RC Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Print 1

This document contains PHP code for a web form that allows users to insert student data into a MySQL database. The form collects three fields: roll number, name, and course, and submits the data to the 'student' table in the 'cmri' database. The code establishes a database connection and executes an insert query upon form submission.

Uploaded by

RC Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Php code for insert data insert.

php
//database cmri tablelname is student having three fields. rollno,name,course

<body>

<form name="form1" method="post" action="">

<table>

<tr>

<td>Enter Rollno</td>

<td> <input type="text" name="rollno" /></td>

</tr>

<tr>

<td>Enter Name</td>

<td><input type="text" name="name" /></td>

</tr>

<tr>

<td>Enter Course</td>

<td> <input type="text" name="course" /></td>

</tr>

<td colspan="2">

<input type="submit" name="submit1" value="Insert" />

</td>

</tr>

</table>

</form>

<?php

//$link=mysqli_connect("118.67.248.12","radiationhill","rajnish"); online work in own domain

$link=mysqli_connect("localhost","root","");

mysqli_select_db($link,"cmri");

if(isset($_POST["submit1"]))

mysqli_query($link,"insert into student values($_POST[rollno],'$_POST[name]','$_POST[course]')");

?>

</body>

You might also like