View file siwap.ru/apps/profile/edit.php

File size: 3.05Kb
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/system/App.php';
$title = 'Редактировать анкету';
require_once ROOT.'/system/header.php';
$user->access();
?>
<div class="col-sm"></div>
<div class="col-sm-8 col-md-6 col-lg-4">
	
<script type="text/javascript">
	$(document).ready(function () {
		var alerts = $('#alerts');
		
		$('#profile-form').on('submit', function(e) {
			e.preventDefault();
			var formData = $(this).serialize();
			
			$.ajax({
				url: '/AJAX/profile/editProfile.php',
				type: 'POST',
				data: formData,
				dataType: 'json',
				success: function(json) {
					
					if (json['success'] == 1)
					{
						alerts.addClass("alert alert-success");
						alerts.html(json['comment']);
					}
					else
					{
						alerts.addClass("alert alert-danger");
						alerts.html(json['comment']);
					}
					
					setTimeout(function() {
						alerts.removeClass();
						alerts.html('');
					}, 1000);
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n " + xhr.responseText);
				}
			});
		});
	});
	</script>
	<div id="alerts"></div>
	
	<div class="card">
		<div class="card-body">
			<form id="profile-form" role="form">
				<div class="form-group">
					<label for="InputName" class="form-check-label text-info">Имя</label>
					<input type="text" class="form-control" id="InputName" name="name" value="<?=$me['name']?>">
				</div>
				<div class="form-group">
					<label for="InputLastName" class="form-check-label text-info">Фамилия</label>
					<input type="text" class="form-control" id="InputLastName" name="last_name" value="<?=$me['last_name']?>">
				</div>
				<div class="form-group">
					<label for="InputCountry" class="form-check-label text-info">Страна</label>
					<input type="text" class="form-control" id="InputCountry" name="country" value="<?=$me['country']?>">
				</div>
				<div class="form-group">
					<label for="InputCountry" class="form-check-label text-info">Город</label>
					<input type="text" class="form-control" id="InputCity" name="city" value="<?=$me['city']?>">
				</div>
				<div class="form-group">
					<label for="InputAge" class="form-check-label text-info">Возраст</label>
					<input type="number" class="form-control" id="InputAge" name="age" value="<?=$me['age']?>">
				</div>
				<div class="form-group">
					<label for="InputLogin" class="form-check-label text-info">Логин</label>
					<input type="text" class="form-control" id="InputLogin" name="login" value="<?=$me['login']?>">
				</div>
				<div class="form-group">
					<label for="InputEmail" class="form-check-label text-info">Email</label>
					<input type="text" class="form-control" id="InputEmail" name="email" value="<?=$me['email']?>">
				</div>
				<button type="submit" class="btn btn-md btn-theme-active btn-block" id="okButton">Редактировать</button>
			</form>
		</div>
	</div>
	
</div>
<div class="col-sm"></div>
<?php
require ROOT.'/system/footer.php';
?>