View Single Post
  #4 (permalink)  
Old Jan 19th, 2008, 21:20
skuliaxe skuliaxe is offline
Junior Member
Join Date: Jan 2008
Location: Reykjavik
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with HTML form to database (mysql/php)!

As you can all see, I´m new to all this. So thanks for all the help.

Quote:
Originally Posted by jackfranklin
The thing I would suggest is, you should not be inserting a value of null into the id field, I presume that is your Primary Key, and in your screen it says it cannot be null....
So try:
I fixed that, thanks. The 'id' is my primary key and is set to auto increment.

Quote:
Originally Posted by Bravo81
First off, DO NOT include your DB Connection details, edit & remove them for security!

Only thing i can think of is $_GET ? instead of post, but then again im no PHP wiz.
I edited that out, thanks. I didn't mean to have that info there. But after using copy/paste a few times I got it in there somehow This is although just a test database right now.

I´ll read up on $_GET and see if that will help me. Thank you.

The PHP is echoing the right information that is entered in the Forms and there doesn't seem to be a database connection error.
So shouldn't the error lie in the Insert to table part?

PHP: Select all

// create and execute the query to insert data
$query "INSERT INTO $db_table (Len,Riki,Fylking,Undirfylking,Flokkur,Undirflokkur,Aettbalkur,Undiraettbalkur,Aett,Undiraett,Aettkvisl,Tegund,Heiti) VALUES ('$form_len','$form_riki','$form_fylking','$form_undirfylking','$form_flokkur','$form_undirflokkur','$form_aettbalkur','$form_undiraettbalkur','$form_aett','$form_undiraett','$form_aettkvisl','$form_tegund')";
$result mysql_query($query); 

Last edited by skuliaxe; Jan 19th, 2008 at 21:30.
Reply With Quote