sudsy1970 Posted November 15, 2008 Share Posted November 15, 2008 hi all, I have a register form on my website and I want to transfer the details to a database. The trouble is I can't seem to get it to work. I am trying to just enter the $_POST data from the form, is this right? I can connect to the database, but can't get the information into the database. Here is my code: $sql = "INSERT into users"; $sql.= "VALUES \""$_POST.['Firstname']."\",\""$_POST.['Surname']."\""; \""$_POST.['Email']."\",\""$_POST.['Dob']."\",\""$_POST.['Password1']."\"\""$_POST. ['User']."\"; Cheers for any help sudsy Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/ Share on other sites More sharing options...
Maq Posted November 15, 2008 Share Posted November 15, 2008 1) You need to specify what fields you're inserting into BEFORE the VALUES. 2) The POST calls are the wrong syntax (you need to take out the periods). 3) You're not executing the mysql_query. 4) I think your code looks very sloppy, let me help you out. $Firstname = $_POST['Firstname']; $Surname = $_POST['Surname']; $Email = $_POST['Email']; $Dob = $_POST['Dob']; $Password1 = $_POST['Password1']; $User = $_POST['User']; mysql_query("INSERT into users (Firstname, Surename, Email, Dob, Password1, User) VALUES ('$Firstname', '$Surename', '$Email', '$Dob', '$Password1', '$User') ") or die(mysql_error()); Please check out this tutorial on the basics on INSERT, Tizag - INSERT Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-690953 Share on other sites More sharing options...
sudsy1970 Posted November 15, 2008 Author Share Posted November 15, 2008 Cool, it almost works. That's great mate cheers code is sloppy as i am just learning this php thing. i wasn't sure if i needed to specify my fields or if you could just input the form values. The only info that isn't in the database now is the Dob. In the database the Dob field shows the 0000-00-00 format, does this mean i make sure the potential users enter their Dob in that format ? Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-690973 Share on other sites More sharing options...
flyhoney Posted November 15, 2008 Share Posted November 15, 2008 You can get the users to enter their birthday's month, date and year using select boxes, and then format it however you need. Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-690982 Share on other sites More sharing options...
Garethp Posted November 15, 2008 Share Posted November 15, 2008 Sorry about this idiot, he is just some douche, ignore him Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-690992 Share on other sites More sharing options...
sudsy1970 Posted November 15, 2008 Author Share Posted November 15, 2008 Awesome thanks guys, problem solved in only 20 minutes. Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-690998 Share on other sites More sharing options...
Maq Posted November 16, 2008 Share Posted November 16, 2008 who is an idiot? Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-691055 Share on other sites More sharing options...
Garethp Posted November 16, 2008 Share Posted November 16, 2008 There was a guy spamming the forum before Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-691061 Share on other sites More sharing options...
Maq Posted November 16, 2008 Share Posted November 16, 2008 There was a guy spamming the forum before Oh OK, I guess his post was deleted. Quote Link to comment https://forums.phpfreaks.com/topic/132858-solved-submitting-multiple-entries-into-a-sql-database/#findComment-691662 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.