Kristopher
Photographer
- Dec 25, 2010
- 802
- 66
Please don't judge however I'm trying to post values from a registration into a database and for some reason its throwing me a error and now allowing me to however the page is completely white. I've been away from Website development and I don't know much PHP and if someone could help me to at least get the information to submit so I can work on Login error messages and what not that would be extremely helpful!
The form:
<?php
$db_server = "localhost";
$db_username = "root";
$db_password = "King12";
$db_database = "ares";
$regiuser=$_POST['regiuser'];
$motto=$_POST['motto'];
$email=$_POST['email'];
$password1=$_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 ('$regiuser', '$motto', '$password1', '$email', '250', '5000', '1')";
$conn->exec($sql);
echo "<script>alert('Account successfully added'); window.location='index.php'</script>";
?>
$db_server = "localhost";
$db_username = "root";
$db_password = "King12";
$db_database = "ares";
$regiuser=$_POST['regiuser'];
$motto=$_POST['motto'];
$email=$_POST['email'];
$password1=$_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 ('$regiuser', '$motto', '$password1', '$email', '250', '5000', '1')";
$conn->exec($sql);
echo "<script>alert('Account successfully added'); window.location='index.php'</script>";
?>
The form:
<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">
<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>
<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">
<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>