Dobrý deň. Chcel by som spraviť aby si užívateľ mohol meniť údaje čo zadával pri registrácií. Ako to mám spraviť? Za pomoc Ďakujem.
<?php include "base.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User Management System (Tom Cameron for NetTuts)</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="main">
<?php
if(!empty($_POST['username']) && !empty($_POST['password']))
{
$meno = mysql_real_escape_string($_POST['meno']);
$priezvisko = mysql_real_escape_string($_POST['priezvisko']);
$username = mysql_real_escape_string($_POST['username']);
$pohlavie = mysql_real_escape_string($_POST['pohlavie']);
$password = md5(mysql_real_escape_string($_POST['password']));
$email = mysql_real_escape_string($_POST['email']);
$checkusername = mysql_query("SELECT * FROM users WHERE Username = '".$username."'");
if(mysql_num_rows($checkusername) == 1)
{
echo "<h1>Error</h1>";
echo "<p>Sorry, that username is taken. Please go back and try again.</p>";
}
else
{
$registerquery = mysql_query("INSERT INTO users (Meno, Priezvisko, Username, Pohlavie, Password, EmailAddress) VALUES('".$meno."','".$priezvisko."','".$username."','".$pohlavie."','".$password."', '".$email."')");
if($registerquery)
{
echo "<h1>Success</h1>";
echo "<p>Your account was successfully created. Please <a href=\"index.htm\">click here to login</a>.</p>";
}
else
{
echo "<h1>Error</h1>";
echo "<p>Sorry, your registration failed. Please go back and try again.</p>";
}
}
}
else
{
?>
<h1>Register</h1>
<p>Please enter your details below to register.</p>
<form method="post" action="register.php" name="registerform" id="registerform">
<fieldset>
<label for="meno">Krstné Meno:</label><input type="text" name="meno" id="meno" /><br />
<label for="priezvisko">Priezvisko:</label><input type="text" name="priezvisko" id="priezvisko" /><br />
<label for="username">Username:</label><input type="text" name="username" id="username" /><br />
<label for="pohlavie">Pohlavie:</label><select name="pohlavie" id="pohlavie" size="1" >
<option value="Muz"> Muž
<option value="Zena"> Žena
</select> <br /><br />
<label for="password">Password:</label><input type="password" name="password" id="password" /><br />
<label for="email">Email Address:</label><input type="text" name="email" id="email" /><br />
<input type="submit" name="register" id="register" value="Register" />
</fieldset>
</form>
<?php
}
?>
</div>
</body>
</html>
Na jednom fóre my poradili že mám spraviť imputy tie spracovať a updatnút do databázy. Len neviem ako to mám spraviť, pomôže my tu niekto? Bol by som vám moc vďačný keby ste my to ukázali npr. na Username. Nato jak to funguje to prídem aj sám. Ďakujem Vám.