chris_rulez001 Posted June 13, 2007 Share Posted June 13, 2007 i am getting this error: Parse error: parse error, unexpected $ in /www/1111mb.com/m/i/n/minispace/htdocs/temp/add_user.php on line 58 the code: <?php $email = $_POST['email'] ; $first = $_POST['nameFirst'] ; $last = $_POST['nameLast'] ; $username = $_POST['username'] ; $password = $_POST['password'] ; $cpassword = $_POST['cpassword'] ; $age = $_POST['age'] ; $gender = $_POST['gender'] ; $ip=$_SERVER['REMOTE_ADDR']; if ($email == "") { echo "Error: You havent entered your email<br/><br/>"; } elseif ($first == "") { echo "Error: You havent entered your first name<br/><br/>"; } elseif ($last == "") { echo "Error: You havent entered your last name<br/><br/>"; } elseif ($username == "") { echo "Error: You havent entered your username<br/><br/>"; } elseif ($password == "") { echo "Error: You havent entered your password<br/><br/>"; } elseif ($cpassword == $password) { echo "Error: You havent confirmed your password properly<br/><br/>"; } elseif ($age == "" || $age < 13) { echo "Error: You must be 13 or over to join<br/><br/>"; } elseif ($age == "DD/MM/YYYY") { echo "Error: You havent entered your age<br/><br/>"; } elseif ($gender == "" || $gender != "Male" || $gender != "male" || $gender != "female" || $gender != "Female" ) { echo "Error: You havent entered your gender<br/><br/>"; } else { include ('includes/mysql_connect_users'); $mysqlinsert="INSERT INTO users(username, password, email, firstname, lastname, age, gender, ip)VALUES('$username', '$password', '$email', '$first', '$last', '$age', '$gender', '$ip')"; $result2=mysql_query($mysqlinsert); if($result2){ echo "<div align='center'><h4><strong><u>Write This Information Down</u></strong></h4><br/><br/>"; echo "<u><strong>Your Login Information</strong></u><br/><br/>"; echo "Your Registered Username:".$username."<br/><br/>"; echo "Your Registered Password:".$password."<br/><br/><br/>"; echo "<u><strong>Other Information</strong></u><br/><br/>"; echo "Your Registered Name Is:".$first. $last."<br/><br/>"; echo "Your Registered Email:".$email."<br/><br/>"; echo "Your Registered Age:".$age."<br/><br/>"; echo "Your Registered Gender:".$gender."<br/><br/><br/><br/>"; echo "You Are Successfully Registered,"; echo "Click <a href='index.php'>Here</a>"; echo "To Return To The Homepage"; ?> i need help urgently, please help me Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/ Share on other sites More sharing options...
Link Posted June 13, 2007 Share Posted June 13, 2007 Missing } for if ($result2) {. Close it off and you should be fine. Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274210 Share on other sites More sharing options...
Link Posted June 13, 2007 Share Posted June 13, 2007 And the } closing the else { as well it looks. Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274211 Share on other sites More sharing options...
simcoweb Posted June 13, 2007 Share Posted June 13, 2007 You need a closing } before the ?> tag. Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274212 Share on other sites More sharing options...
chris_rulez001 Posted June 13, 2007 Author Share Posted June 13, 2007 thanks Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274217 Share on other sites More sharing options...
chris_rulez001 Posted June 14, 2007 Author Share Posted June 14, 2007 i have tried putting a } at the end of my code and it looks like this now my code: <?php $email = $_POST['email'] ; $first = $_POST['nameFirst'] ; $last = $_POST['nameLast'] ; $username = $_POST['username'] ; $password = $_POST['password'] ; $cpassword = $_POST['cpassword'] ; $age = $_POST['age'] ; $gender = $_POST['gender'] ; $ip=$_SERVER['REMOTE_ADDR']; if ($email == "") { echo "Error: You havent entered your email<br/><br/>"; } elseif ($first == "") { echo "Error: You havent entered your first name<br/><br/>"; } elseif ($last == "") { echo "Error: You havent entered your last name<br/><br/>"; } elseif ($username == "") { echo "Error: You havent entered your username<br/><br/>"; } elseif ($password == "") { echo "Error: You havent entered your password<br/><br/>"; } elseif ($cpassword == $password) { echo "Error: You havent confirmed your password properly<br/><br/>"; } elseif ($age == "" || $age < 13) { echo "Error: You must be 13 or over to join<br/><br/>"; } elseif ($age == "Age (e.g. 14)") { echo "Error: You havent entered your age<br/><br/>"; } elseif ($gender == "" || $gender != "Male" || $gender != "male" || $gender != "female" || $gender != "Female" ) { echo "Error: You havent entered your gender<br/><br/>"; } else { include ('includes/mysql_connect_users'); $mysqlinsert="INSERT INTO users(username, password, email, firstname, lastname, age, gender, ip)VALUES('$username', '$password', '$email', '$first', '$last', '$age', '$gender', '$ip')"; $result2=mysql_query($mysqlinsert); if($result2){ echo "<div align='center'><h4><strong><u>Write This Information Down</u></strong></h4><br/><br/>"; echo "<u><strong>Your Login Information</strong></u><br/><br/>"; echo "Your Registered Username:".$username."<br/><br/>"; echo "Your Registered Password:".$password."<br/><br/><br/>"; echo "<u><strong>Other Information</strong></u><br/><br/>"; echo "Your Registered Name Is:".$first. $last."<br/><br/>"; echo "Your Registered Email:".$email."<br/><br/>"; echo "Your Registered Age:".$age."<br/><br/>"; echo "Your Registered Gender:".$gender."<br/><br/><br/><br/>"; echo "You Are Successfully Registered,"; echo "Click <a href='index.php'>Here</a>"; echo "To Return To The Homepage"; } ?> but im still getting the error, just to remind you what the error is: Parse error: parse error, unexpected $ in /www/1111mb.com/m/i/n/minispace/htdocs/temp/add_user.php on line 59 Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274492 Share on other sites More sharing options...
paul2463 Posted June 14, 2007 Share Posted June 14, 2007 you need another closing brace at the end to close off the last Else statement you code should look like this <?php $email = $_POST['email'] ; $first = $_POST['nameFirst'] ; $last = $_POST['nameLast'] ; $username = $_POST['username'] ; $password = $_POST['password'] ; $cpassword = $_POST['cpassword'] ; $age = $_POST['age'] ; $gender = $_POST['gender'] ; $ip=$_SERVER['REMOTE_ADDR']; if ($email == "") { echo "Error: You havent entered your email<br/><br/>"; } elseif ($first == "") { echo "Error: You havent entered your first name<br/><br/>"; } elseif ($last == "") { echo "Error: You havent entered your last name<br/><br/>"; } elseif ($username == "") { echo "Error: You havent entered your username<br/><br/>"; } elseif ($password == "") { echo "Error: You havent entered your password<br/><br/>"; } elseif ($cpassword == $password) { echo "Error: You havent confirmed your password properly<br/><br/>"; } elseif ($age == "" || $age < 13) { echo "Error: You must be 13 or over to join<br/><br/>"; } elseif ($age == "Age (e.g. 14)") { echo "Error: You havent entered your age<br/><br/>"; } elseif ($gender == "" || $gender != "Male" || $gender != "male" || $gender != "female" || $gender != "Female" ) { echo "Error: You havent entered your gender<br/><br/>"; } else { include ('includes/mysql_connect_users'); $mysqlinsert="INSERT INTO users(username, password, email, firstname, lastname, age, gender, ip)VALUES('$username', '$password', '$email', '$first', '$last', '$age', '$gender', '$ip')"; $result2=mysql_query($mysqlinsert); if($result2){ echo "<div align='center'><h4><strong><u>Write This Information Down</u></strong></h4><br/><br/>"; echo "<u><strong>Your Login Information</strong></u><br/><br/>"; echo "Your Registered Username:".$username."<br/><br/>"; echo "Your Registered Password:".$password."<br/><br/><br/>"; echo "<u><strong>Other Information</strong></u><br/><br/>"; echo "Your Registered Name Is:".$first. $last."<br/><br/>"; echo "Your Registered Email:".$email."<br/><br/>"; echo "Your Registered Age:".$age."<br/><br/>"; echo "Your Registered Gender:".$gender."<br/><br/><br/><br/>"; echo "You Are Successfully Registered,"; echo "Click <a href='index.php'>Here</a>"; echo "To Return To The Homepage"; } } ?> Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274497 Share on other sites More sharing options...
chris_rulez001 Posted June 14, 2007 Author Share Posted June 14, 2007 thanks it works now Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274509 Share on other sites More sharing options...
paul2463 Posted June 14, 2007 Share Posted June 14, 2007 can you click the "Solved" button then please??? Link to comment https://forums.phpfreaks.com/topic/55490-solved-help-error-after-submit-need-help-urgently/#findComment-274860 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.