Kan någon säga vad felet är ?
Visa spoiler
<?php
//Database connection
mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db('users') or die(mysql_error());
//Check if user want to register
if(isset($_GET['registrera'])) {
$username = $_POST ['username'];
$password = $_POST ['password'];
}
mysql_query("INSERT INTO accounts (username, password)
VALUES
(' $username', ' $password')");
?>
<h2>Registrera </h2>
<form method="post" name="registrera" action="?registrera">
<input type="hidden" name="registrera" value="random" />
Användarnamn <br />
<input type="text" name="username"> <br />
Lösenord <br />
<input type="password" name="password"> <br />
<input type="submit" value="Registrera" />
</form>
//Database connection
mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db('users') or die(mysql_error());
//Check if user want to register
if(isset($_GET['registrera'])) {
$username = $_POST ['username'];
$password = $_POST ['password'];
}
mysql_query("INSERT INTO accounts (username, password)
VALUES
(' $username', ' $password')");
?>
<h2>Registrera </h2>
<form method="post" name="registrera" action="?registrera">
<input type="hidden" name="registrera" value="random" />
Användarnamn <br />
<input type="text" name="username"> <br />
Lösenord <br />
<input type="password" name="password"> <br />
<input type="submit" value="Registrera" />
</form>
Kodapa