0% found this document useful (0 votes)
43 views2 pages

User PHP

The PHP code connects to a MySQL database called "crudop" and defines an INSERT query to add user data including name, email, mobile number, and password to a database table called "leo". The form allows users to enter this data which is then submitted to the PHP code to insert into the database table. If successful, a success message is displayed.

Uploaded by

Vansh Rana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

User PHP

The PHP code connects to a MySQL database called "crudop" and defines an INSERT query to add user data including name, email, mobile number, and password to a database table called "leo". The form allows users to enter this data which is then submitted to the PHP code to insert into the database table. If successful, a success message is displayed.

Uploaded by

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

<?

php
$con= mysqli_connect("localhost", "root", "", "crudop");

if(isset($_POST['submit'])){
$name= $_POST['name'];
$email= $_POST['email'];
$mobile= $_POST['mobile'];
$password= $_POST['password'];

//inset query
$sql = "INSERT INTO leo (name,email,mobile,password)
VALUES ('$name','$email','$mobile','$password')";

//execute this query


$result= mysqli_query($con,$sql);
//we will check
if($result){
echo "data inserted";
//header('location:display.php');
}else
{
die(mysqli_error($con));
}
}

?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">

<!-- Bootstrap CSS -->


<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha384-
Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">

<title>Hello, world!</title>
</head>
<body>
<div class="container my-4">
<form method="POST">
<div class="form-group" >
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="name" placeholder="Name">
</div>
<label>Email</label>
<input type="text" class="form-control" name="email"
id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter
email">

</div>
<div class="form-group">
<label>Mobile Number</label>
<input type="text" class="form-control" name="mobile"
id="exampleInputPassword1" placeholder="Mobile Number">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" name="password"
id="exampleInputPassword1" placeholder="Password">
</div>

<button type="submit" name="submit" class="btn btn-primary">Submit</button>


</form>

</div>

<!-- Optional JavaScript -->


<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-
KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js"
integrity="sha384-
ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
integrity="sha384-
JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</body>
</html>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy