Current location: Hot Scripts Forums » Programming Languages » PHP » can you help me my signup page is not working plz help....


can you help me my signup page is not working plz help....

Reply
  #1 (permalink)  
Old 05-30-04, 10:20 AM
johny johny is offline
Newbie Coder
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Question can you help me my signup page is not working plz help....

ok here is the script use:

<?php

// dbConfig.php is a file that contains your
// database connection information. This
// tutorial assumes a connection is made from
// this existing file.
include ("dbconfig.php");


// ==== Input validation and PHP dBase code ===============================
//
// ================================================== ======================

if ( $_GET["op"] == "reg" )
{
$bInputFlag = false;
foreach ( $_POST as $field )
{
if ($field == "")
{
$bInputFlag = false;
}
else
{
$bInputFlag = true;
}
}
// If we had problems with the input, exit with error
if ($bInputFlag == false)
{
die( "Problem with your registration info. "
."Please go back and try again.");
}

// Fields are clear, add user to database
// Setup query
$q = "INSERT INTO `dbusers` (`username`,`password`,`email`) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
// Run query
$r = mysql_query($q);

// Make sure query inserted user successfully
if ( !mysql_insert_id() )
{
die("Error: User not added to database.");
}
else
{
// Redirect to thank you page.
Header("Location: register.php?op=thanks");
}
} // end if



// ==== Thank you page ================================================== ==
//
// ================================================== ======================
elseif ( $_GET["op"] == "thanks" )
{
echo "<h2>Thanks for registering!</h2>";
}



// ==== Main Form ================================================== =======
//
// ================================================== ======================
else
{
echo "<form action=\"?op=reg\" method=\"POST\">\n";
echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n";
echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n";
echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n";
echo "<input type=\"submit\">\n";
echo "</form>\n";
}
// EOF
?>



but then when i go to test it out to see if it works it says

error:user not added to database can you plz help,thanks
Reply With Quote
  #2 (permalink)  
Old 05-30-04, 04:26 PM
johny johny is offline
Newbie Coder
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
r u gonna help

can you please help me i really need it because this script needs to be done by tomorrow
Reply With Quote
  #3 (permalink)  
Old 05-30-04, 04:45 PM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
Do you have phpMyAdmin? Because I don't think the database is set up to work with this script.
Reply With Quote
  #4 (permalink)  
Old 05-31-04, 06:28 AM
johny johny is offline
Newbie Coder
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
yup

yes i have phpmyadmin what do you suggest
Reply With Quote
  #5 (permalink)  
Old 05-31-04, 09:37 PM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
Replace this query:

PHP Code:

$q "INSERT INTO `dbusers` (`username`,`password`,`email`) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')"
WITH

PHP Code:

$q "INSERT INTO dbusers (username,password,email) VALUES ('$_POST[username]', '$_POST[password]', '$_POST[email]')"
This will fix your problem
Reply With Quote
  #6 (permalink)  
Old 06-01-04, 02:54 PM
johny johny is offline
Newbie Coder
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
ok

oh ok i will try that thanks for the help
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically refresh page after page load failure jdugger JavaScript 3 08-05-10 09:16 AM
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
Paginating problem,extra empty page morrowind PHP 2 05-03-04 03:32 AM
page browsing problem mivec PHP 3 04-17-04 03:43 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 10:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.