Module #10
website link - tericiar.infinityfree.me/module4.php
In this
module, I learned how to connect PHP to a MySQL database and insert data from
an HTML form into a database table. At first, it seemed a little tricky because
you have to make sure your PHP script can actually “talk” to the database, but
once I got the hang of it, it started making sense.
We started
by creating a table in MySQL using phpMyAdmin. I set up columns for first name,
last name, and email so that when someone fills out the form, their information
has a place to go. Then, I created a simple HTML form where users can type in
their information. The form uses the POST method to send the data, which is
important because it keeps the information secure and organized.
The really
interesting part was writing the PHP script to handle the form data. I used the
$_POST superglobal to grab the data from the form and then used an SQL INSERT
statement to put it into my MySQL table. I also learned that connecting to the
database requires the correct server name, username, password, and database
name. One mistake in those details can cause the connection to fail, so you
have to be careful.
By the end
of the module, I was able to submit the form and see the new records appear in
my database. It felt really satisfying to see it all working together because
it’s a real example of how websites store and manage information. Overall, this
module gave me a much better understanding of how PHP and MySQL work together
to create dynamic web applications, and I’m excited to use this skill in future
projects.
Comments
Post a Comment