Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 06-25-2007, 03:08 PM
Sergeant
 
Join Date: Jun 2007
Posts: 24
Default Registration script problem

This is the script, its not working for some reason ! I cannot understand why!

Quote:
PHP Code:
<?php
$username 
$_POST['username'];
$password $_POST['password'];
$password2 = ['password2'];

If (
$password == $password2) {
mysql_connect("localhost""blahblah""blah") or die mysql_error());
mysql_select_db("databasename") or die mysql_error());
mysql_query("INSERT INTO 'registrationdetails' (Username) Values ('$username')") or die(mysql_error()); }
elseif (
$password != $password2) {
echo 
"passwords did not match" };
?>
this still wont work :S i think 'registrationdetails' (Username) Values ('$username')") is the part that is not working. I dont think $username is actually getting assigned to the string that the user inputted into the editbox, meaning the code is insert nothing so no new records are being made..

this is the html for the edit box:

HTML Code:
<input type="text" id="Editbox2" size="16" name="Username" value="" maxlength="11">
should it be
PHP Code:
$username $_POST['editbox2']; 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 06-25-2007, 04:15 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,033
Default Re: Registration script problem

No. Your editbox (in the login form) is named "Username" so the string that is passed over to the verification script is "Username". Under this point of view, your script correctly has "username" but you need to change the editbox name in "username" with lowercase "u" .

And, why you inserting in the database only the username and not the password also ?

Also, as a good rule, the database fields should be the same as the php script and form variables. So, if you use "username" for the form and script, it would be wise that the database field for the username should be also "username" and not "Username" so that you will not get confused and make mistakes.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 06-25-2007, 08:01 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,640
Default Re: Registration script problem

Also
$password2 = ['password2'];
needs to be
$password2 = $_POST['password2'];

You may also want to encrypt your password before inserting it into a database. As well as verify that you user filled in the information
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 06-25-2007, 09:01 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,033
Default Re: Registration script problem

I need better glasses!!!! Thanks watdaflip!!
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 12:25 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2007 VodaHost.com - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55