Kod odpowiedzialny za rozwijanie ( jQuery ) :
$(function() {
$('.rozwin').on('click',function() {
var rozwinId = $(this).attr('data-moreid');
$('#'+rozwinId).slideToggle(500);
return false;
});
});
Kod w głównym plku index.php :
<div class="wrapper" id="register-content" style="display:none">
<?php
if (isset($_POST['register'])){
if (registerNewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['email'])){
echo "Gratulacje, właśnie się zarejestrowałeś! Sprawdź pocztę email, zaraz otrzymasz (lub już dostałeś) dane potrzebne do zalogowania się. ";
}else {
echo "Rejestracja sie nie powiodła, spróbuj ponownie.";
show_registration_form();
}
} else {
// has not pressed the register button
show_registration_form();
}
?>
</div>
No i wspomniana wcześniej funkcja show_registration_form() :
<?php
function show_registration_form(){
echo '<form action="index.php" method="post">
<fieldset><legend>Rejestracja</legend>
<dl>
<dt><label for="username">Login:</label></dt>
<dd><input name="username" type="text" id="username" maxlength="30">
</dd>
</dl>
<dl>
<dt><label for="password">Hasło:</label></dt>
<dd><input name="password" type="password" id="password" maxlength="15">
</dd>
</dl>
<dl>
<dt><label for="password2">Powtórz hasło:</label></dt>
<dd><input name="password2" type="password" id="password2" maxlength="15">
</dd>
</dl>
<dl>
<dt><label for="email">E-mail:</label></dt>
<dd><input name="email" type="text" id="email" maxlength="255">
</dd>
</dl>
<p>
<input name="reset" type="reset" value="Resetuj">
<input name="register" type="submit" class=".button-1" value="Rejestruj">
</p>
</fieldset>
</form>';
?>