how to fix a php registration form 404 error [duplicate]
This question already has an answer here:
Reference - What does this error mean in PHP?
32 answers
How to display errors for my MySQLi query? [duplicate]
3 answers
i am currently working on a registration form project but i constantly bump into an error which i can't seem to figure out. The error consists of the registration button sending me to a 404 error page instead of doing the intended code. Can anyone spot any errors as i can't seem to find any. Please help.
<?php
session_start();
$_SESSION ['Error'] = '';
$mysqli = new mysqli ('ip', 'user', 'pass', 'dbname');
$_POST = filter_input_array(INPUT_POST);
if ($_POST['username']) {
$username = $_POST['username'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['email']) {
$email = $_POST['email'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['password'] === $_POST['psw-repeat']) {
$password = $_POST['password'];
}
else {
$_SESSION['Error'] = "Your passwords don't match";
}
if ($_POST['captcha'] === $_SESSION['captcha']) {
}
else {
$_SESSION['Error'] = "Incorrect CAPTCHA";
}
//
$sql = "INSERT INTO Users (User_name, Email, Password, Skills)"
."VALUES ('$username','$email','$password','$skills')";
//if the query is successful, redirect to validation.php page
if ($mysqli->query($sql) === true) {
$_SESSION['Error'] = "Registration Succesful! Added $username to the database!";
header("location: validation.php");
}
else {
$_SESSION['Error'] = "User could not be added to the database!";
}
?>
This is my HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="registration.css">
<title>
</title>
</head>
<body>
<form action="action_page.php" style="border:1px none #ccc">
<div class="container">
<h1>New Registration</h1>
<p>Please enter registration info below</p>
<hr>
<label for="username"><b>New Username:</b></label>
<p>
<input type="text" placeholder="Enter your new username" name="username">
</p>
<label for="email"><b>Email:</b></label>
<p>
<input type="text" placeholder="Enter Email" name="email" required>
</p>
<label for="skills"><b>Skills:</b></label>
<p>
<input type="text" placeholder="Enter Skills" name="skills" required>
</p>
<label for="psw"><b>Password:</b></label>
<p>
<input type="password" placeholder="Password" name="psw" required>
</p>
<label for="psw-repeat"><b>Repeat Password:</b></label>
<p>
<input type="password" placeholder="Repeat Password" name="psw-repeat" required>
</p>
<label>
<p>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</p>
</label>
<label for="captcha"><b>CAPTCHA</b></label>
<br>
<div class="captcha">
<img src="captcha.php" alt="CAPTCHA image">
</div>
<br>
<input type="text" placeholder="Insert CAPTCHA" name="captcha" required>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" class="signupbtn">Sign Up</button>
</div>
</div>
</form>
</body>
</html>
php html mysql forms session
marked as duplicate by Funk Forty Niner
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 16:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
show 3 more comments
This question already has an answer here:
Reference - What does this error mean in PHP?
32 answers
How to display errors for my MySQLi query? [duplicate]
3 answers
i am currently working on a registration form project but i constantly bump into an error which i can't seem to figure out. The error consists of the registration button sending me to a 404 error page instead of doing the intended code. Can anyone spot any errors as i can't seem to find any. Please help.
<?php
session_start();
$_SESSION ['Error'] = '';
$mysqli = new mysqli ('ip', 'user', 'pass', 'dbname');
$_POST = filter_input_array(INPUT_POST);
if ($_POST['username']) {
$username = $_POST['username'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['email']) {
$email = $_POST['email'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['password'] === $_POST['psw-repeat']) {
$password = $_POST['password'];
}
else {
$_SESSION['Error'] = "Your passwords don't match";
}
if ($_POST['captcha'] === $_SESSION['captcha']) {
}
else {
$_SESSION['Error'] = "Incorrect CAPTCHA";
}
//
$sql = "INSERT INTO Users (User_name, Email, Password, Skills)"
."VALUES ('$username','$email','$password','$skills')";
//if the query is successful, redirect to validation.php page
if ($mysqli->query($sql) === true) {
$_SESSION['Error'] = "Registration Succesful! Added $username to the database!";
header("location: validation.php");
}
else {
$_SESSION['Error'] = "User could not be added to the database!";
}
?>
This is my HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="registration.css">
<title>
</title>
</head>
<body>
<form action="action_page.php" style="border:1px none #ccc">
<div class="container">
<h1>New Registration</h1>
<p>Please enter registration info below</p>
<hr>
<label for="username"><b>New Username:</b></label>
<p>
<input type="text" placeholder="Enter your new username" name="username">
</p>
<label for="email"><b>Email:</b></label>
<p>
<input type="text" placeholder="Enter Email" name="email" required>
</p>
<label for="skills"><b>Skills:</b></label>
<p>
<input type="text" placeholder="Enter Skills" name="skills" required>
</p>
<label for="psw"><b>Password:</b></label>
<p>
<input type="password" placeholder="Password" name="psw" required>
</p>
<label for="psw-repeat"><b>Repeat Password:</b></label>
<p>
<input type="password" placeholder="Repeat Password" name="psw-repeat" required>
</p>
<label>
<p>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</p>
</label>
<label for="captcha"><b>CAPTCHA</b></label>
<br>
<div class="captcha">
<img src="captcha.php" alt="CAPTCHA image">
</div>
<br>
<input type="text" placeholder="Insert CAPTCHA" name="captcha" required>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" class="signupbtn">Sign Up</button>
</div>
</div>
</form>
</body>
</html>
php html mysql forms session
marked as duplicate by Funk Forty Niner
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 16:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
A 404 means that the page couldn't be found. Can you show the code/form where your registration button is? And maybe show/tell us about the structure of your files(file names and folders).
– Dirk Scholten
Nov 19 '18 at 16:03
404 means not found....
– Sfili_81
Nov 19 '18 at 16:03
@DirkScholten the validation php and registration php are in the same source folder and this is the code for the button<button type="submit" class="signupbtn">Sign Up</button>
– D.Reaper
Nov 19 '18 at 16:06
You may want to check the "action" of your form (the destination .php file from your origin .html file).
– Alberto
Nov 19 '18 at 16:08
Well we need a bit more than just the button. You can edit your original post and add the whole<form>
to it. That way we can see what page it tries to go to.
– Dirk Scholten
Nov 19 '18 at 16:08
|
show 3 more comments
This question already has an answer here:
Reference - What does this error mean in PHP?
32 answers
How to display errors for my MySQLi query? [duplicate]
3 answers
i am currently working on a registration form project but i constantly bump into an error which i can't seem to figure out. The error consists of the registration button sending me to a 404 error page instead of doing the intended code. Can anyone spot any errors as i can't seem to find any. Please help.
<?php
session_start();
$_SESSION ['Error'] = '';
$mysqli = new mysqli ('ip', 'user', 'pass', 'dbname');
$_POST = filter_input_array(INPUT_POST);
if ($_POST['username']) {
$username = $_POST['username'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['email']) {
$email = $_POST['email'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['password'] === $_POST['psw-repeat']) {
$password = $_POST['password'];
}
else {
$_SESSION['Error'] = "Your passwords don't match";
}
if ($_POST['captcha'] === $_SESSION['captcha']) {
}
else {
$_SESSION['Error'] = "Incorrect CAPTCHA";
}
//
$sql = "INSERT INTO Users (User_name, Email, Password, Skills)"
."VALUES ('$username','$email','$password','$skills')";
//if the query is successful, redirect to validation.php page
if ($mysqli->query($sql) === true) {
$_SESSION['Error'] = "Registration Succesful! Added $username to the database!";
header("location: validation.php");
}
else {
$_SESSION['Error'] = "User could not be added to the database!";
}
?>
This is my HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="registration.css">
<title>
</title>
</head>
<body>
<form action="action_page.php" style="border:1px none #ccc">
<div class="container">
<h1>New Registration</h1>
<p>Please enter registration info below</p>
<hr>
<label for="username"><b>New Username:</b></label>
<p>
<input type="text" placeholder="Enter your new username" name="username">
</p>
<label for="email"><b>Email:</b></label>
<p>
<input type="text" placeholder="Enter Email" name="email" required>
</p>
<label for="skills"><b>Skills:</b></label>
<p>
<input type="text" placeholder="Enter Skills" name="skills" required>
</p>
<label for="psw"><b>Password:</b></label>
<p>
<input type="password" placeholder="Password" name="psw" required>
</p>
<label for="psw-repeat"><b>Repeat Password:</b></label>
<p>
<input type="password" placeholder="Repeat Password" name="psw-repeat" required>
</p>
<label>
<p>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</p>
</label>
<label for="captcha"><b>CAPTCHA</b></label>
<br>
<div class="captcha">
<img src="captcha.php" alt="CAPTCHA image">
</div>
<br>
<input type="text" placeholder="Insert CAPTCHA" name="captcha" required>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" class="signupbtn">Sign Up</button>
</div>
</div>
</form>
</body>
</html>
php html mysql forms session
This question already has an answer here:
Reference - What does this error mean in PHP?
32 answers
How to display errors for my MySQLi query? [duplicate]
3 answers
i am currently working on a registration form project but i constantly bump into an error which i can't seem to figure out. The error consists of the registration button sending me to a 404 error page instead of doing the intended code. Can anyone spot any errors as i can't seem to find any. Please help.
<?php
session_start();
$_SESSION ['Error'] = '';
$mysqli = new mysqli ('ip', 'user', 'pass', 'dbname');
$_POST = filter_input_array(INPUT_POST);
if ($_POST['username']) {
$username = $_POST['username'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['email']) {
$email = $_POST['email'];
}
else {
$_SESSION['Error'] = "Please enter your username";
}
if ($_POST['password'] === $_POST['psw-repeat']) {
$password = $_POST['password'];
}
else {
$_SESSION['Error'] = "Your passwords don't match";
}
if ($_POST['captcha'] === $_SESSION['captcha']) {
}
else {
$_SESSION['Error'] = "Incorrect CAPTCHA";
}
//
$sql = "INSERT INTO Users (User_name, Email, Password, Skills)"
."VALUES ('$username','$email','$password','$skills')";
//if the query is successful, redirect to validation.php page
if ($mysqli->query($sql) === true) {
$_SESSION['Error'] = "Registration Succesful! Added $username to the database!";
header("location: validation.php");
}
else {
$_SESSION['Error'] = "User could not be added to the database!";
}
?>
This is my HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="registration.css">
<title>
</title>
</head>
<body>
<form action="action_page.php" style="border:1px none #ccc">
<div class="container">
<h1>New Registration</h1>
<p>Please enter registration info below</p>
<hr>
<label for="username"><b>New Username:</b></label>
<p>
<input type="text" placeholder="Enter your new username" name="username">
</p>
<label for="email"><b>Email:</b></label>
<p>
<input type="text" placeholder="Enter Email" name="email" required>
</p>
<label for="skills"><b>Skills:</b></label>
<p>
<input type="text" placeholder="Enter Skills" name="skills" required>
</p>
<label for="psw"><b>Password:</b></label>
<p>
<input type="password" placeholder="Password" name="psw" required>
</p>
<label for="psw-repeat"><b>Repeat Password:</b></label>
<p>
<input type="password" placeholder="Repeat Password" name="psw-repeat" required>
</p>
<label>
<p>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</p>
</label>
<label for="captcha"><b>CAPTCHA</b></label>
<br>
<div class="captcha">
<img src="captcha.php" alt="CAPTCHA image">
</div>
<br>
<input type="text" placeholder="Insert CAPTCHA" name="captcha" required>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" class="signupbtn">Sign Up</button>
</div>
</div>
</form>
</body>
</html>
This question already has an answer here:
Reference - What does this error mean in PHP?
32 answers
How to display errors for my MySQLi query? [duplicate]
3 answers
php html mysql forms session
php html mysql forms session
edited Nov 19 '18 at 17:45
Dirk Scholten
572217
572217
asked Nov 19 '18 at 16:00
D.Reaper
12
12
marked as duplicate by Funk Forty Niner
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 16:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Funk Forty Niner
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 16:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
A 404 means that the page couldn't be found. Can you show the code/form where your registration button is? And maybe show/tell us about the structure of your files(file names and folders).
– Dirk Scholten
Nov 19 '18 at 16:03
404 means not found....
– Sfili_81
Nov 19 '18 at 16:03
@DirkScholten the validation php and registration php are in the same source folder and this is the code for the button<button type="submit" class="signupbtn">Sign Up</button>
– D.Reaper
Nov 19 '18 at 16:06
You may want to check the "action" of your form (the destination .php file from your origin .html file).
– Alberto
Nov 19 '18 at 16:08
Well we need a bit more than just the button. You can edit your original post and add the whole<form>
to it. That way we can see what page it tries to go to.
– Dirk Scholten
Nov 19 '18 at 16:08
|
show 3 more comments
2
A 404 means that the page couldn't be found. Can you show the code/form where your registration button is? And maybe show/tell us about the structure of your files(file names and folders).
– Dirk Scholten
Nov 19 '18 at 16:03
404 means not found....
– Sfili_81
Nov 19 '18 at 16:03
@DirkScholten the validation php and registration php are in the same source folder and this is the code for the button<button type="submit" class="signupbtn">Sign Up</button>
– D.Reaper
Nov 19 '18 at 16:06
You may want to check the "action" of your form (the destination .php file from your origin .html file).
– Alberto
Nov 19 '18 at 16:08
Well we need a bit more than just the button. You can edit your original post and add the whole<form>
to it. That way we can see what page it tries to go to.
– Dirk Scholten
Nov 19 '18 at 16:08
2
2
A 404 means that the page couldn't be found. Can you show the code/form where your registration button is? And maybe show/tell us about the structure of your files(file names and folders).
– Dirk Scholten
Nov 19 '18 at 16:03
A 404 means that the page couldn't be found. Can you show the code/form where your registration button is? And maybe show/tell us about the structure of your files(file names and folders).
– Dirk Scholten
Nov 19 '18 at 16:03
404 means not found....
– Sfili_81
Nov 19 '18 at 16:03
404 means not found....
– Sfili_81
Nov 19 '18 at 16:03
@DirkScholten the validation php and registration php are in the same source folder and this is the code for the button<button type="submit" class="signupbtn">Sign Up</button>
– D.Reaper
Nov 19 '18 at 16:06
@DirkScholten the validation php and registration php are in the same source folder and this is the code for the button<button type="submit" class="signupbtn">Sign Up</button>
– D.Reaper
Nov 19 '18 at 16:06
You may want to check the "action" of your form (the destination .php file from your origin .html file).
– Alberto
Nov 19 '18 at 16:08
You may want to check the "action" of your form (the destination .php file from your origin .html file).
– Alberto
Nov 19 '18 at 16:08
Well we need a bit more than just the button. You can edit your original post and add the whole
<form>
to it. That way we can see what page it tries to go to.– Dirk Scholten
Nov 19 '18 at 16:08
Well we need a bit more than just the button. You can edit your original post and add the whole
<form>
to it. That way we can see what page it tries to go to.– Dirk Scholten
Nov 19 '18 at 16:08
|
show 3 more comments
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
2
A 404 means that the page couldn't be found. Can you show the code/form where your registration button is? And maybe show/tell us about the structure of your files(file names and folders).
– Dirk Scholten
Nov 19 '18 at 16:03
404 means not found....
– Sfili_81
Nov 19 '18 at 16:03
@DirkScholten the validation php and registration php are in the same source folder and this is the code for the button<button type="submit" class="signupbtn">Sign Up</button>
– D.Reaper
Nov 19 '18 at 16:06
You may want to check the "action" of your form (the destination .php file from your origin .html file).
– Alberto
Nov 19 '18 at 16:08
Well we need a bit more than just the button. You can edit your original post and add the whole
<form>
to it. That way we can see what page it tries to go to.– Dirk Scholten
Nov 19 '18 at 16:08