0

Is it possible to enter HTML form data into a database with SQL without using a PHP script?

2
  • 2
    No. Without Server Side Scripting Posting Data to DataBase Not possible at all. If you are Stuck check out This geeksforgeeks.org/… Commented Jul 23, 2021 at 7:13
  • Certainly we do not want to open our databases for connections from anywhere. Commented Jul 23, 2021 at 8:16

2 Answers 2

1

It is possible to do it without using a PHP script, but not without using some kind of server-sided script. if your database is stored on a server. It doesn't have to be PHP, it just needs to be something that can take your form data and pass it to the database. Or if your database is stored on your client PC, you could do it there I guess.

Sign up to request clarification or add additional context in comments.

2 Comments

so if the database is stored in the client's pc, we should be able to enter the data into databases without server-sided script, or thats not possible either?
I imagine there would be a lot of security issues in trying to get something like Javascript (running on your client PC browser) to write directly to the client PC hard disk, so it would be down to whether it's possible to disable enough of that to allow it. A massive security concern, though.
0

No you can't (so far my knowledge goes, i never heard of it anyway) plus you might get into big security problems as you have no control of injection attaks. Always use a server language of any kind (php, asp, python, java or similar) and validate all data before it gets pushed to the database. anyway you can pull data directly with html/xml (old fashined way) but still i think of leaks! my advice to begin with would be a framework what does the job for you in a secure/ save way like laravel, symfony, yii2 or doctrine. there is very much example code and your learning curve for php might be easier thank plain php.

here's the link to the old fashion way of getting data without php but not sending it to the db directly: https://smallbusiness.chron.com/insert-form-mysql-51070.html

5 Comments

cant a local website and database be used without server side aid? or should we still use server side, even if the website is never published out of the local host?
Why not just set up something like WAMP or XAMPP so you still have a database server, but configure to only allow local access? What's the reason that you don't want to use a server-side script to write to the database?
There is a competition and I wanted to know if we could add data from form to a database with just javascript and SQL or not. Because there was a registration form to be made and enter that data in a database with SQL. So, if it's not considered cheating, I thought I could search about it. And the only languages allowed are HTML, CSS, JavaScript and SQL.
Ok then i suggest Node.js you can find some information here: w3schools.com/nodejs/nodejs_mysql.asp
To insert MySQL Data directly into your DB from the users browser (as i know) still not possible. you have to have some sort of driver/ connector that connects to your db server otherwise filebased json db or csv would be an alternative.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.