I HAVE SUCCEEDED IN SUBMITTING MY MESSAGE INTO THE DATABASE, HURRAY!
All these moments I knew that there was something missing to connect these files together and I do not believe others’ method and due to my lazy symptoms and I did not try any of that. This might sound dramatic…? But at the end something clicked and I decided to just give it a try with others’ method and VIOLA.
I followed and copied the code and paste it with mine and it WORKED *cries happy tears*… especially this $area = $_POST[‘area’]; As I have tried defining the input submit’s name and nothing happened but when I define the textarea’s name into a function it worked!
Backtrack to my previous attempts:
As my mindset was having 2 PHP files.
1.1 PHP file is to submit the messages to the database
1.2 PHP file is to form a connection to the database (MySQL)
From here, I missed out the point and all the research that I have found, I’ve noticed that they have included the database login details in each PHP files as they need to submit the data into the database as well as calling out the data from the database, and without it, nothing works.
So it does not send any data if I have 2 separate PHP files, therefore current update only used one PHP files that contain all the info inside and not separating it into another PHP files (I think I can separate it just that not sure if it looks tedious and it is still workable by including the “include “php file”, and ONE IMPORTANT THING WAS, that PHP file contained all my database login info which was risky and insecure and that’s why I think Mervin suggested me for having two files, however for current progress my final call will be using only one PHP. *Will further ask Mervin questions about this.
Furthermore, I have changed mysql to mysqli because of the system is deprecating so using mysqli and especially when I worked on the code secure system and read that the function mysql_real_escape_string is deprecating so I thought a little bit and might as well changed it.
Other than that, I think I confused myself with Mervin has suggested me about having 2 PHP files or not… I don’t recall, but that’s what I remembered vividly and he did drew out the process on his notebook.