dizzleboi1 Posted March 13, 2008 Share Posted March 13, 2008 see i have a register form and the only pages are the functions.php and the register.php. everytime i attempt to sign up the page will just go blank what is the problem here? <?php include_once "functions.php"; connect(); if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"register.php\">\n"; echo "<tr><td colspan=\"2\" align=\"center\">Registration Form</td></tr>\n"; echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Password</td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td>Confirm</td><td><input type=\"password\" name=\"passconf\"></td></tr>\n"; echo "<tr><td>E-Mail</td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td>Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>AIM Address</td><td><input type=\"text\" name=\"aim\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td></tr>\n"; echo "</form></table>\n"; }else { $username = protect($_POST['username']); $password = protect($_POST['password']); $confirm = protect($_POST['passconf']); $email = protect($_POST['email']); $name = protect($_POST['name']); $aim = protect($_POST['aim']); $errors = array(); if (!$username) { $errors[] = "Username is not defined!"; } if($password){ $errors[] = "Password is not defined!"; } if($password){ if(!$confirm){ $errors[] = "Confirmation password is not defined!"; } } if(!$email){ $errors[] = "Email is not defined!"; } if(!$name){ $errors[] = "Name is not defined!"; } If (!$aim){ $errors[] = "AIM Screename is not defined!"; } if ($username) { if(!ctype_alnum($username)){ $errors[] = "Username can only contain numbers and letters!"; } } if($password && $confirm) { } } ?> functions.php <?php function protect($string){ $string = mysql_real_escape_string($string); $string = strip_tags($string); $string = addslashes($string); return $string; } function connect () { $con = mysql_connect( 'localhost', 'MYNAME', 'MYPASSWORD') or die(mysql_error()); $db = mysql_select_db( 'MYNAME_users', $con); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/ Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 Looks like you only gave it a place to show errors, but not a place to show it has worked. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490912 Share on other sites More sharing options...
teng84 Posted March 13, 2008 Share Posted March 13, 2008 try error reporting to see the errors.. try to put this at the top of your script error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490913 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 try error reporting to see the errors.. try to put this at the top of your script error_reporting(E_ALL); And after you do that, give us the errors you receive. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490914 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 i put it at the top of functions and got this Notice: Undefined index: submit in /home/MYNAME/public_html/register.php on line 6 Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490917 Share on other sites More sharing options...
teng84 Posted March 13, 2008 Share Posted March 13, 2008 i c no post data no post index.. if(!isset($_POST['submit'])) { } instead of if(!$_POST['submit']){ Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490920 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 NEW ERROR Parse error: syntax error, unexpected '}' in /home/MYNAME/public_html/register.php on line 18 Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490921 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 TRY: if($_POST['submit']){ I don't know why...but try it. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490925 Share on other sites More sharing options...
teng84 Posted March 13, 2008 Share Posted March 13, 2008 try <?php error_reporting(E_ALL); include_once "functions.php"; connect(); if(!isset($_POST['submit'])){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"register.php\">\n"; echo "<tr><td colspan=\"2\" align=\"center\">Registration Form</td></tr>\n"; echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Password</td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td>Confirm</td><td><input type=\"password\" name=\"passconf\"></td></tr>\n"; echo "<tr><td>E-Mail</td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td>Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>AIM Address</td><td><input type=\"text\" name=\"aim\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td></tr>\n"; echo "</form></table>\n"; } else { $username = protect($_POST['username']); $password = protect($_POST['password']); $confirm = protect($_POST['passconf']); $email = protect($_POST['email']); $name = protect($_POST['name']); $aim = protect($_POST['aim']); $errors = array(); if (!$username) { $errors[] = "Username is not defined!"; } if($password){ $errors[] = "Password is not defined!"; } if($password){ if(!$confirm){ $errors[] = "Confirmation password is not defined!"; } } if(!$email){ $errors[] = "Email is not defined!"; } if(!$name){ $errors[] = "Name is not defined!"; } If (!$aim){ $errors[] = "AIM Screename is not defined!"; } if ($username) { if(!ctype_alnum($username)){ $errors[] = "Username can only contain numbers and letters!"; } } if($password && $confirm) { } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490928 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 worked but it still seems to bring me to a blank page Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490929 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 Because you haven't given it anything to show: <?php error_reporting(E_ALL); include_once "functions.php"; connect(); if(!isset($_POST['submit'])){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"register.php\">\n"; echo "<tr><td colspan=\"2\" align=\"center\">Registration Form</td></tr>\n"; echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr>\n"; echo "<tr><td>Password</td><td><input type=\"password\" name=\"password\"></td></tr>\n"; echo "<tr><td>Confirm</td><td><input type=\"password\" name=\"passconf\"></td></tr>\n"; echo "<tr><td>E-Mail</td><td><input type=\"text\" name=\"email\"></td></tr>\n"; echo "<tr><td>Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>AIM Address</td><td><input type=\"text\" name=\"aim\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td></tr>\n"; echo "</form></table>\n"; } else { $username = protect($_POST['username']); $password = protect($_POST['password']); $confirm = protect($_POST['passconf']); $email = protect($_POST['email']); $name = protect($_POST['name']); $aim = protect($_POST['aim']); $errors = array(); if (!$username) { $errors[] = "Username is not defined!"; } if($password){ $errors[] = "Password is not defined!"; } if($password){ if(!$confirm){ $errors[] = "Confirmation password is not defined!"; } } if(!$email){ $errors[] = "Email is not defined!"; } if(!$name){ $errors[] = "Name is not defined!"; } If (!$aim){ $errors[] = "AIM Screename is not defined!"; } if ($username) { if(!ctype_alnum($username)){ $errors[] = "Username can only contain numbers and letters!"; } } if($password && $confirm) { echo "IT WORKS!"; } } ?> I think thats were it goes... Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490931 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 now when hit browse on the table i dont see myself signed up is it im not routing my tables correctly? Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490932 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 all that seem to have done is let the user know that the password was entered or not i hit 2 totally different passwords with nothing else filled and got the "IT WORKS!" confirm,, which is what i dont want Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490935 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 Try and see if there is something wrong with mysql: functions.php <?php function protect($string){ $string = mysql_real_escape_string($string); $string = strip_tags($string); $string = addslashes($string); return $string; } function connect () { $con = mysql_connect( 'localhost', 'MYNAME', 'MYPASSWORD') or die(mysql_error()); $db = mysql_select_db( 'MYNAME_users', $con) or die(mysql_error()); } ?> This is starting to get weird... Sorry I couldn't help. ---- Do you use cpanel? If so I THINK I see the error. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490939 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 yea i went to control panel on my web hoster and there server host is local host and i had named my db "WITHMYNAME_users" thats what i put for the select statement in functions just to let you know and the name has to go before the name u choose. i just dont see where i can connect the form to the db table so it knows where to store it because as you know my codes suck a bit Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490942 Share on other sites More sharing options...
teng84 Posted March 13, 2008 Share Posted March 13, 2008 can you tell us your real problem now? Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490946 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 Well if your using a shared database with other people, you have to use: $con = mysql_connect( 'localhost', 'MYNAME_username', 'MYPASSWORD') or die(mysql_error()); $db = mysql_select_db( 'MYNAME_dbname', $con) or die(mysql_error()); And you have to created the dbname and username and add permissions to them. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490948 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 can you tell us your real problem now? what do you mean? and derrick i have all the info down, i think my problem is not a way to give the page a place to send the info via table. what am i missing because i clearly havent put the table name down there just not sure how to go about that Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490951 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 someone please help ??? Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490976 Share on other sites More sharing options...
peranha Posted March 13, 2008 Share Posted March 13, 2008 you need something like // create query $query = "INSERT INTO table (field, field, etc) VALUES ($value, $value, etc)"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); After all checks are done. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490980 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 you need something like // create query $query = "INSERT INTO table (field, field, etc) VALUES ($value, $value, etc)"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); After all checks are done. omg thats what i forgot the insert query not exactly this but the insert into 'users' etc. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490992 Share on other sites More sharing options...
derrick1123 Posted March 13, 2008 Share Posted March 13, 2008 Please reply and tell us if this works. Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-490995 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 im making the commands now Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-491000 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 im getting a new error when i sign up i got all the things i needed now i get this You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Admin','0b91dec4fe98266a03b136b59219d0d6','testemail1@yahoo.com','Testname','te' at line 3 Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-491071 Share on other sites More sharing options...
dizzleboi1 Posted March 13, 2008 Author Share Posted March 13, 2008 i will post the new source if anyone needs it Quote Link to comment https://forums.phpfreaks.com/topic/95889-solved-php-register-to-blank-page/#findComment-491072 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.