PHP to MySQL database woes :(!!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
Snaek
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Dec 29, 2012 6:02 pm

Re: PHP to MySQL database woes :(!!

Post by Snaek » Mon Dec 31, 2012 1:58 pm

In your register.html file, try changing the code of <input type="button"... to <input type="submit" ...

That may be the problem because currently, the input type button is not doing anything because you don't even have a JS event on it, but that's alright, try changing 'button' to 'submit'.

hope this works.

Edit:

Also, how does how insert.php file know what the user typed in the forms?

Because, you have: mysql_query("INSERT INTO Login (Email_Address, Password) VALUES (email, password)");

and the "VALUES" are email, password, where are you getting these? Im assuming they are the 'names' in your HTML form, but that's not how it works. try this:

insert.php

Code: Select all

// CONNECTION CODE HERE...

$email = $_POST['email']; // << that right there is posting the HTML form's value and putting it in a variable called '$email'
$password = $_POST['password']; // same thing here, but for the password

// INSERT THE NEW INFORMATION HERE...
mysql_query("INSERT INTO Login (Email_Address, Password) VALUES ($email, $password)");
// in the above line, the only thing changed in the variables in the VALUES section.
I think this should solve your problem.

If you have any more problems, feel free to reply here.

Also, write down your code in the code tags given in this editor. Thanks

Hope this helped!

Snaek
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Dec 29, 2012 6:02 pm

Re: PHP to MySQL database woes :(!!

Post by Snaek » Mon Dec 31, 2012 9:18 pm

It's nice to see that you got it to work!!

User avatar
gether
New php-forum User
New php-forum User
Posts: 16
Joined: Tue Dec 25, 2012 7:38 pm

Re: PHP to MySQL database woes :(!!

Post by gether » Tue Jan 01, 2013 5:53 am

glad it worked

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 5 guests