View file users/edit.php

File size: 2.52Kb
<?php

require '../inc/func.php';
bk_head('Edit Profile');
require '../inc/head.php';

if(!$user){
header('location: index.php');
}


#####edit######

echo '<div class="list1"><div class="tt">Edit Profile</div><div class="shadow">';
if(isset($_POST['save'])){

$d = $_POST['d'];
$m = $_POST['m'];
$y = $_POST['y'];
$dob = ''.$d.'-'.$m.'-'.$y.'';
$province = $_POST['province'];
$about = $_POST['about'];
$rela = $_POST['rela'];
$wk = $_POST['wk'];
$inter = $_POST['inter'];

if(!empty($wk)){
mysql_query("UPDATE `users` SET `dob` = '$dob', `province` = '$province', `about_me` = '$about', `rela` ='$rela', `wk` = '$wk' WHERE `id` = '$userid'");
err ('Successfully Updated');
}else{
err ('Empty filed');
}
}
?>

<form action="edit.php" method="post">
<p>
	    <label>DOB</label> <br> 
		<select name="d">
			<?php for ($i = 1; $i <= 31; $i++) : ?>
			    <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
			<?php endfor; ?>
		</select>
		<select name="m">
			<?php for ($i = 1; $i <= 12; $i++) : ?>
			    <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
			<?php endfor; ?>
		</select>
		<select name="y">
			<?php for ($i = 1996; $i >= 1900; $i--) : ?>
			    <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
			<?php endfor; ?>
		</select>
	</p>
	<p>
	    <label>Country</label> <br>
		<?php include 'func_province.php';?>
		<select name="province">
			<?php foreach ($provinces_array as $provinces_id => $provinces_name) : ?>
			    <option value="<?php echo $provinces_id; ?>"><?php echo $provinces_name; ?></option>
			<?php endforeach; ?>
		</select>
	</p>
	<p>
	    <label>Relationship</label> <br>
		<select name="rela">
		<?php 
		$for_array = array (
    'Ế Lòi',
	'Có Người Yêu',
	'Đang Tìm Người Yêu',
	'Đã Kết Hôn',
	'Độc Thân'
);
?>
			<?php foreach ($for_array as  $for_name) : ?>
			    <option value="<?php echo $for_name; ?>"><?php echo $for_name; ?></option>
			<?php endforeach; ?>
		</select>
	</p>
	    <p>
        <label>Interesting</label><br>
        <textarea name="inter" maxlength="250"></textarea>
    </p>
    <p>
        <label>Working</label><br>
        <textarea name="wk" maxlength="250"><?php echo user_info($userid, 'wk');?></textarea>
    </p>
	<p>
        <label>More About Me</label><br>
		<textarea name="about" maxlength="250"><?php echo user_info($userid, 'about_me');?></textarea>
    </p>
<input type="submit" value="Save" name="save">
</form>



</div></div>
<?php
bk_foot();
?>