blink359 Posted April 27, 2009 Share Posted April 27, 2009 Ive been trying to get my PhP for account creation working so i started simple again to make it easier to find problem here it is: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home2/worldsof/public_html/random/test.php on line 14 <?php include('config.php'); mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); $success = true; $problemMessage = ""; if (isset($_POST['Submit'])) if ($success) { echo "Valid New Account Entry<br />"; $result = mysql_query("INSERT INTO `accounts` VALUES ('', '$_POST['user']', '$_POST['pass2']', '', '', '0', '', '', '', '$_POST['flag']', 'enUS', '0', '0', null);") or die("Error: (" . mysql_errno() . ") " . mysql_error()); } $row = mysql_fetch_array( $result ); } ?> <html> <head> <title>Account Creation Page</title> </head> <body> <form> Account Creation Page<br> Username: <input name="user" type="text"/> <br> Password: <input name="pass" type="text"/> <br> Repeat Password: <input name="pass2" tpye="text"/> <br /> Pre TBC <input type="radio" name="flag" value="0"> <br> TBC Enabled <input type="radio" name="flag" value="8"> <br> Wotlk Enabled <input type="radio" name="flag" value="24"> <br> <input name="Submit" type="submit" value="submit" /> </p> <imput name="reset" type="reset" value="reset" /> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/155883-form-problems/ Share on other sites More sharing options...
Mchl Posted April 27, 2009 Share Posted April 27, 2009 When using array variables in double quoted strings, you have to put them in curly braces, like this: $result = mysql_query("INSERT INTO `accounts` VALUES ('', '{$_POST['user']}', '{$_POST['pass2']}', '... Link to comment https://forums.phpfreaks.com/topic/155883-form-problems/#findComment-820519 Share on other sites More sharing options...
blink359 Posted April 27, 2009 Author Share Posted April 27, 2009 Ah thanks for that i didnt know that as i was previously using $user = $_POST['user']; Link to comment https://forums.phpfreaks.com/topic/155883-form-problems/#findComment-820521 Share on other sites More sharing options...
Mchl Posted April 27, 2009 Share Posted April 27, 2009 But it wasn't within a string. See section 'Variable parsing' here: http://www.php.net/manual/en/language.types.string.php Link to comment https://forums.phpfreaks.com/topic/155883-form-problems/#findComment-820524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.