tags:

views:

98

answers:

3

Hello,

I am new to php, javascript and mysql. Just started 3 days ago. I have a form with some textboxes and listboxes. But now I need to save everything in a database using a INSERT query. Can anybody help me plz?

Greetings Stijn

A: 

There are various tutorials out there on the net.

Here's your checklist of things you now have to do:

  • Create a database and some tables (you might want to use a software like phpmyadmin because it's easier if you have a GUI)
  • Learn how to connect to the mysql server using php (have a look at the mysql_connect function)
  • Get some infos about how to make INSERT and SELECT querys in mysql (as I said a lot of tutorials on the net)
  • Learn something about SQL Injection (a possible security problem with your web form)
svens
A: 

Big Areas to Focus:

1) Make your form. Use standard HTML input elements and use the "name" attribute.

2) Focus the Form "action" and "method".

3) Grab the variables out of the POST or GET array ($_POST['input_name'] or
$_GET['input_name']).

4) Use a SQL insert statement to insert the form values into the particular table you want the data stored.

This should help you with an insert http://www.tizag.com/mysqlTutorial/mysqlinsert.php

This will help with the Form aspect. http://www.w3schools.com/php/php_forms.asp

Good Luck!

mmundiff
A: 
minnur
This is a very harmful example. Please put "addslashes" around $_POST[] in the SQL string otherwise you may experience SQL injections. Not good.
hurikhan77
Hi thanks for notice. But it's better to start with simple examples first. Security is next step.
minnur