Witam. Prosiłbym o pomoc w przerobieniu tego pliku na funkcje tak aby zwracał zmienna String zawierajaca treść jaka ten plik ma wyświetlać na stronie
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?PHP
//ini_set('display_errors', 1);
//error_reporting(~0);
require_once('functions.php');
$user=session_check();
?>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/css/uikit.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/js/uikit.min.js"> </script>
</head>
<body>
<?PHP
show_menu($user);
$conn = dbconnect_RS2_to_SLAVE();
$query=mysql_query("SELECT * FROM users WHERE login='".$user['username']."';");
$data=mysql_fetch_array($query);
if(isset($_POST['edit'])){
$conn = dbconnect_RS2_to_MASTER();
mysql_query(
"UPDATE users SET
name='".$_POST['name']."',
surname='".$_POST['surname']."',
addres='".$_POST['addres']."',
city='".$_POST['city']."',
nip='".$_POST['nip']."',
pesel='".$_POST['pesel']."'
WHERE id='".$user['id']."'");
mysql_close($conn);
if(!empty($_FILES['image'])){
move_uploaded_file($_FILES['image']['tmp_name'],'images/'.$user['id'].'.jpg');
}
redis_set_json('userid:'.$user['id'], $user['username'],0);
header("Location:index.php");
}else{
?>
<form method="post" class="uk-form" enctype="multipart/form-data">
<fieldset data-uk-margin>
<legend>Edit</legend>
<!--<label for="username">Login</label>
<input name="username" type="text" value="<?php echo $data['login']?>"><br>
<label for="password">Name</label>
<input name="password" type="password" value="<?php echo $data['password']?>"><br><br>-->
<label for="name">Name</label>
<input name="name" type="text" value="<?php echo $data['name']?>"><br>
<label for="surname">Surame</label>
<input name="surname" type="text" value="<?php echo $data['surname']?>"><br>
<label for="addres">Addres</label>
<input name="addres" type="text" value="<?php echo $data['addres']?>"><br>
<label for="city">City</label>
<input name="city" type="text" value="<?php echo $data['city']?>"><br>
<label for="nip">Nip</label>
<input name="nip" type="text" value="<?php echo $data['nip']?>"><br>
<label for="pesel">Pesel</label>
<input name="pesel" type="text" value="<?php echo $data['pesel']?>"><br>
<label for="image">Image</label>
<input type="file" name="image"><br>
<button type="submit" name="edit" class="uk-button">Edit</button>
</fieldset>
</form>
<?php
}
?>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
Plik nie jest mojego autorstwa a ja dopiero raczkuje w php. Z góry dziękuje za pomoc