Step 1
Step 1
This dbConn.php file will use everywhere, where you want to perform a task with the database.
Here it is connected with the local database and check database connected or not.
dbConn.php
<?php
$db = mysqli_connect("localhost","root","","testDB");
if(!$db)
?>
edu-community
edu-community
Home Community Categories Database How to send data to my database from html and css...
How to send data to my database from html and css Contact Us Form
votes
votes
Hi, @Sign
Xampp is a free and open-source cross-platform web server solution stack package developed by Apache
Friends, consisting mainly of the Apache HTTP Server, MySQL database, and interpreters for scripts
written in the PHP and Perl programming languages.
2. Next, we will require an editor where the HTML code has to be written. You can use any editor (such
as Notepad++, Adobe Dreamweaver, NetBeans, etc). Here we will use Notepad ++.
3. Open the Notepad++ text editor and write the HTML code for designing the HTML Sign Up page. We
can use various HTML tags to design the page. You can include the fields according to your convenience.
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h2>Sign Up</h2>
<label>First Name:</label>
</div>
<label>Middle Name:</label>
</div>
<label>Last Name:</label>
</div>
</div>
</div>
</form>
</body>
</html>
votes
Hello @Sign,
It is simple to create contact form to send email or any other information and storing in mysql database.
Using INSERT INTO statement you can insert new data into a database table.
Output:
This dbConn.php file will use everywhere, where you want to perform a task with the database.
Here it is connected with the local database and check database connected or not.
dbConn.php
<?php
$db = mysqli_connect("localhost","root","","testDB");
if(!$db)
?>
Here's a simple HTML form which is index.php file. It has two text input and a submit button.
The INSERT INTO statement is used to add new data into the database. This insert query will execute
passing through to the PHP mysqli_query() function to insert new data.
And also created a simple HTML form which has two input text and a submit button which is used to
take data from users.
In the index.php file the dbConn.php file includes for connecting with the database and insert new data.
The form has two field fullname and age which are get data from users and store into the database.
In this example the PHP code and the HTML form coded in the single page. The PHP script embedded
with the HTML page.
index.php
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
if(isset($_POST['submit']))
$fullname = $_POST['fullname'];
$age = $_POST['age'];
if(!$insert)
echo mysqli_error();
else
}
mysqli_close($db); // Close connection
?>
<form method="POST">
<br/>
<br/>
</form>
</body>
</html>