How do I make a web form that saves information to a database? - web form database
Hey,
So I want to do an online form (at a site), that users can fill them with simple information. Once you fill out, I would like) the information stored in a MySQL database (or something like that. I want to be able to access this information on a separate website. How can I do? I'm not big into programming, it would be a great help for me if I can, thanks to a tool that you can use.
Thank you!
4 comments:
Without knowing anything about PHP, I doubt that you can do. You need someone preparing to rent. ∠ °)
I think you can with a free program called OutWit Hub to do:
Check www.recs4free.com.
I will be happy to get started.
You can use PHP for this. In your HTML form element, you define the attributes method = "post" action = "url_of_the_php_file. Be sure to enter a unique name for each input field on the form.
Then, when the user clicks Submit, the browser will send the data in a PHP script. All form data is stored in a special variable called $ _POST saved PHP.
Before you send data to the database, the script must connect to it. This is done with the mysql_connect () function. For example, $ db = mysql_connect ( "localhost", "yourDbUserName", ") yourDbPassword" contains the variable $ db "link" to the base. You do not need much, because PHP will automatically use the latest link if you can not say that he should not use them if necessary.
You can varname data in the syntax $ _POST as $ = $ _POST [ "Form Field Name 'access]. However, we recommend that you use
$ Varname = mysql_real_escape_string ($ _POST [ "Form Field Name"]);
toall your data, it is to protect your site is not hacked! Happen (Yes, really is.) Ways out of the data as it prevents malicious users from injecting additional commands to your database.
If you have a link to the database and the data in variables, then send an SQL command for INSERT, UPDATE, SELECT, etc. It appears that you have to insert, it would look like this:
$ Query = "INSERT INTO yourtable''(" colName1 ',' colName2, etc) VALUES ( '$ yourVar1', '$ yourVar2, etc.) ";
if (mysql_query ($ sql)) die "Error!"
I suggest reading the two links below before digging into coverage a lot more about the error handling and security, and how they back data in the database. There is much to learn, but you do not control every use. Think about (be avoided because of the requests and all browsers have reported data for that matter). :)
Post a Comment