dominic600 Posted August 6, 2011 Share Posted August 6, 2011 Okay so im working on this website, its my first on and everything im doing is all for learning it. well first off here is the line of code im getting the error from: $form = <form action='register.php' method='post'> error reads: Parse error: syntax error, unexpected '<' in /home/a3888506/public_html/register.php on line 7 then when i change the line from that to: $form = "<form action='register.php' method='post'>"; it give me an error on the next line and that line is : <table> so like im not sure what to do im new to all of this. Thanks, Dominic Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 When putting HTML data inside a variable it has to be wrapped around Quotations and you need to escape the quotes that are the same quotes you're using to wrap the data, there's HEREDOC method too, but post you full code. Quote Link to comment Share on other sites More sharing options...
trq Posted August 6, 2011 Share Posted August 6, 2011 To reiterate what phpSensei is hinting at. To create a string in PHP you need to use quotes. See string. Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 When putting HTML data inside a variable it has to be wrapped around Quotations, theres HEREDOC method too, but post you full code. Actually i got rid of the error but using quotes around the whole table and it workes. but now i have another problem, its posting my table twice on the webpage... also thanks for the quick reply, but heres my code: <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='fistname'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use. $form"; } else echo "That username is currently in use. $form"; } else echo "You did not enter a vaild email. $form"; } else echo "Your passwords did not match. $form"; } else echo"You did not fill in all the required fields. $form"; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 } else echo "That email is currently in use. $form"; } else echo "That username is currently in use. $form"; } else echo "You did not enter a vaild email. $form"; } else echo "Your passwords did not match. $form"; } else echo"You did not fill in all the required fields. $form"; } echo "$form"; Look your printing your form with your ERROR messages again. try this <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='fistname'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use"; } else echo "That username is currently in use"; } else echo "You did not enter a vaild email"; } else echo "Your passwords did not match"; } else echo"You did not fill in all the required fields"; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 Thank you! that fixed that. but just led to another problem.. lol just like my truck haha. but anyways now when i go to test out the regerstration fourm i fill in all the required fields and hit register and still says i did not fill in all required fields.. sorry that i am being a nussiance, im just new to all of this. Thanks again Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 Thank you! that fixed that. Quote Link to comment Share on other sites More sharing options...
trq Posted August 6, 2011 Share Posted August 6, 2011 Is that meant to mean the topic is solved? Why not click the topic solved button at the bottom of your thread? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Dominic, are you bumping your thread or are you good? If your form values are coming as empty, then please proceed to add this, otherwise I don't see a problem with the form nor the script. print var_dump($_POST); right below this line if ($_POST['submitbtn']){ Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 Okay, so once again i have another problem.. So, i get to testing my form and when i hit 'submit' it gives me the message saying i did not fill in all the required fields. last time i did this it worked just fine now idk what i did differently, your help is greatly appriciated! heres a picture of my code if it would help. <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='fistname'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
trq Posted August 6, 2011 Share Posted August 6, 2011 Notice how I edited your original post to use syntax highlighting? Please use the tags when posting code. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 You have TWO firstname FIELDS, Hence if Avatar is empty the condition will return false. Rename the Avatar field to avatar. <td><input type='file' name='fistname'></td> Mark the Thread As Solved Please/ Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 i didnt mean to bump it,, i ment to hit modify instead of quote i guess to tell you i got rid of the errors. sorry. but that print var_dump($_POST); didnt help it actually messed it up more... Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 why don't you read my post man? do you just read it and ignore it? You have TWO input fields name "firstname" edit: You have THREE input fields named "firstname"; use this code <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='avatar'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 Notice how I edited your original post to use syntax highlighting? Please use the tags when posting code. yes i noticed that, i actually thought somehow it did it by its self maybe... ill besure to keep that in mind tho. but im gunna look at the firstname thing right quick Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 your password field is ALSO called firstname. use this code <?php require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='avatar'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 yeah i didnt ignore you man its just the messages came in after i typed that.. sorry. but im gunna ftp it up right quick Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Np 8) Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 Np 8) http://tprofiletesting.net23.net/register.php thats the link, maybe it will work for you. cause im having trouble still.. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Alright please use this code I setup for debugging, and let me know the output <?php ini_set("display_errors","1"); error_reporting(E_ALL); require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='avatar'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); print var_dump($_POST); if (($firstname != "") && ($lastname != "") && ($username != "") && ($email != "") && ($password != "")&& ($repassword != "")){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 replaced my code with yours and it still says i did not fill in my info.. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 I know it says that, I am asking for the error output.. use the latest code I provided up above. Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 not to sound stupid. but where would i see taht error out put... lol Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Use this code, it should print out an array of the posted values from the FORM after you click the submit button <?php ini_set("display_errors","1"); error_reporting(E_ALL); require("styles/top.php"); ?> <div id='content'> <div id='full'> <?php $form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td>Fields indicating <font color='red'>*</font> are require.</td> </tr> <tr> <td>First Name:</td> <td><input type='text' name='fistname'><font color='red'>*</font></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname'><font color='red'>*</font></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username'><font color='red'>*</font></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email'><font color='red'>*</font></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password'><font color='red'>*</font></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword'><font color='red'>*</font></td> </tr> <tr> <td>Avatar:</td> <td><input type='file' name='avatar'></td> </tr> <tr> <td>Website:</td> <td><input type='text' name='website'></td> </tr> <tr> <td>Youtube User Name:</td> <td><input type='text' name='youtube'></td> </tr> <tr> <td>Bio:</td> <td><textarea name='bio' cols='35' rows='5'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repassword = strip_tags($_POST['repassword']); $website = strip_tags($_POST['website']); $youtube = strip_tags($_POST['youtube']); $bio = strip_tags($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); print var_dump($_POST); if (($firstname != "") && ($lastname != "") && ($username != "") && ($email != "") && ($password != "")&& ($repassword != "")){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $query = mysql_query("SELECT * FROM users WHERE email='$email'"); $numrows = mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div> <body> </body> </html> Quote Link to comment Share on other sites More sharing options...
dominic600 Posted August 6, 2011 Author Share Posted August 6, 2011 idk what im doing wrong.. cause i used your code and it didnt change anything.. Quote Link to comment 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.