<?php
$line1 = "50";
$line2 = "50";
if ($_POST){
if (!file_exists($filename)) {
$fp = fopen('config.txt', 'w');
fwrite($fp, $_POST['varcols'] ."\n" .$_POST['varrows']);
fclose($fp);
$lines = file('config.txt');
$line1 = $lines[0];
$line2 = $lines[1];
}
else
{
$fp = fopen('config.txt', 'w');
fwrite($fp, "50" ."\n" ."50");
fclose($fp);
}
}
?>
<body>
<form action="" method="post">
<input type=text name=varcols id=varcols value=<?php echo $line1?>>
<input type=button value="+" id="pluscols"><input type=button value="-" id="minuscols">
<br>
<input type=text name=varrows id=varrows value=<?php echo $line2?>>
<input type=button value="+" id="plusrows"><input type=button value="-" id="minusrows">
<br>
<input type=submit value="изменить размер" name="setcr">
<br>
<textarea cols=<?php echo $line1?> rows=<?php echo $line2?>> </textarea>
</form>
<script>
document.getElementById("pluscols").onclick = function(){
document.getElementById("varcols").value++;
};
document.getElementById("minuscols").onclick = function(){
document.getElementById("varcols").value--;
};
document.getElementById("plusrows").onclick = function(){
document.getElementById("varrows").value++;
};
document.getElementById("minusrows").onclick = function(){
document.getElementById("varrows").value--;
};
</script>
</body>
|