Skip to content

Commit c3f930e

Browse files
committed
Update auto
1 parent f6ad825 commit c3f930e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,16 @@
140140
}
141141
else{
142142
echo "
143+
<h2>Edit <tt>$title</tt></h2>
143144
<center>
144-
<h2>$title</h2>
145145
<form action=\"update.php?id=".$pid."\" method=\"post\">
146146
<br>
147-
<textarea name=\"val\" rows=\"20\" cols=\"80\">$title\n$edpg</textarea>
147+
Title:
148+
<input name=\"tit\" value=\"$title\" type=\"text\"><br><br>
149+
<textarea name=\"val\" rows=\"20\" cols=\"80\">$edpg</textarea>
148150
<br><br>The title of the note is on <B>line 1</B><br><br>
149151
<input type=\"button\" onclick=\"javascrtpt:window.location.href='/?type=view&id=$pid'\" value=\" < Back \">
152+
$share
150153
<input type=\"submit\" value=\" > Save \">
151154
</form>
152155

update.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
echo "<title>Updating</title>";
33
$id=$_GET['id'];
4+
$tit=$_POST['tit'];
45
$val=$_POST['val'];
56
$f=fopen("doc/".$id.".md","w");
6-
fwrite($f,trim($val));
7+
fwrite($f,trim($tit)."\n".trim($val));
78
fclose($f);
89
echo "<script>window.location.href=\"/?type=edit&id=".$id."\";</script>";
910
?>

0 commit comments

Comments
 (0)