Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
PHP Register Error
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="BIOS" data-source="post: 451139" data-attributes="member: 15674"><p>No error messages not really much to go on...</p><p></p><p>But you're missing a name on one of the input fields, assuming you wanted that to be the email. That's likely cause.</p><p></p><p>This is likely what you wanted but I haven't tested it so you might need to change it:</p><p>[CODE=php]// register.php</p><p><?php</p><p></p><p>$db_server = "localhost";</p><p>$db_username = "root";</p><p>$db_password = "King12"; // change me</p><p>$db_database = "ares"; // change me</p><p></p><p>// Check if the fields are actually set..</p><p>if (</p><p> !isset($_POST) ||</p><p> empty($_POST["regiuser"]) ||</p><p> empty($_POST["motto"]) ||</p><p> empty($_POST["email"]) ||</p><p> empty($_POST["password"])</p><p>) {</p><p> print "Missing required fields...";</p><p> exit;</p><p>}</p><p></p><p>$regiuser = $_POST["regiuser"];</p><p>$motto = $_POST["motto"];</p><p>$email = $_POST["email"];</p><p>$password = $_POST["password"];</p><p></p><p>$conn = new PDO("mysql:host=$db_server;dbname=$db_database", $db_username, $db_password);</p><p>$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);</p><p></p><p>$sql = "INSERT INTO users (username, motto, password, email, credits, duckets, rank) VALUES (?,?,?,?,?,?,?)";</p><p>$res = $conn->prepare($sql)->execute([$regiuser, $motto, $password, $email, "250", "5000", "1"]);</p><p></p><p>// If success, redirect to index.php</p><p>if ($res) {</p><p> print "Account successfully added...";</p><p> header("Location: index.php");</p><p> exit;</p><p>}</p><p></p><p>?></p><p></p><p><form method="POST" action="register.php"></p><p> <input class="input" type="text" name="regiuser" style="margin-top:21px;"></p><p> <i class="fa fa-user-o" aria-hidden="true" style="margin-top:33px;"></i></p><p> <input class="input" type="text" name="email"></p><p> <i class="fa fa-envelope" aria-hidden="true"></i></p><p> <input class="input" type="password" name="password"></p><p> <i class="fa fa-lock" aria-hidden="true"></i></p><p> <input class="input" type="text" name="motto"></p><p> <i class="fa fa-lock" aria-hidden="true"></i></p><p> <input class="subinput" type="submit" value="Registrieren"></p><p></form>[/CODE]</p></blockquote><p></p>
[QUOTE="BIOS, post: 451139, member: 15674"] No error messages not really much to go on... But you're missing a name on one of the input fields, assuming you wanted that to be the email. That's likely cause. This is likely what you wanted but I haven't tested it so you might need to change it: [CODE=php]// register.php <?php $db_server = "localhost"; $db_username = "root"; $db_password = "King12"; // change me $db_database = "ares"; // change me // Check if the fields are actually set.. if ( !isset($_POST) || empty($_POST["regiuser"]) || empty($_POST["motto"]) || empty($_POST["email"]) || empty($_POST["password"]) ) { print "Missing required fields..."; exit; } $regiuser = $_POST["regiuser"]; $motto = $_POST["motto"]; $email = $_POST["email"]; $password = $_POST["password"]; $conn = new PDO("mysql:host=$db_server;dbname=$db_database", $db_username, $db_password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO users (username, motto, password, email, credits, duckets, rank) VALUES (?,?,?,?,?,?,?)"; $res = $conn->prepare($sql)->execute([$regiuser, $motto, $password, $email, "250", "5000", "1"]); // If success, redirect to index.php if ($res) { print "Account successfully added..."; header("Location: index.php"); exit; } ?> <form method="POST" action="register.php"> <input class="input" type="text" name="regiuser" style="margin-top:21px;"> <i class="fa fa-user-o" aria-hidden="true" style="margin-top:33px;"></i> <input class="input" type="text" name="email"> <i class="fa fa-envelope" aria-hidden="true"></i> <input class="input" type="password" name="password"> <i class="fa fa-lock" aria-hidden="true"></i> <input class="input" type="text" name="motto"> <i class="fa fa-lock" aria-hidden="true"></i> <input class="subinput" type="submit" value="Registrieren"> </form>[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
PHP Register Error
Top