This repository has been archived by the owner on May 17, 2023. It is now read-only.
forked from if-itb/IF3110-2015-T1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathask.php
50 lines (49 loc) · 1.59 KB
/
ask.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Edit Question</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="/style/master.css" >
</head>
<body>
<?php
require 'query.php';
?>
<?php
$name=$email=$topic=$content=$q_id='';
$address='index.php';
if($_GET){
$q_id=$_GET['q_id'];
$question=getQuestion($q_id);
$name=$question['name'];
$email=$question['email'];
$topic=$question['topic'];
$content=$question['content'];
$q_id=$question['q_id'];
if($_GET['address']=='question'){
$address='question.php?q_id='.$_GET['q_id'];
}
}
?>
<div class="view">
<h1>Simple Stack Exchange</h1><br>
<div id=form>
<h2>What's your question?</h2>
<hr align="left">
<form name="questionForm" method="post" onsubmit="return validateQuestion()" action=<?php echo $address; ?> >
<input type="text" id="name" name="name" value="<?php echo $name ?>" placeholder="Name"><br>
<input type="text" id="email" name="email" value="<?php echo $email ?>" placeholder="Email"><br>
<input type="text" id="topic" name="topic" value="<?php echo $topic ?>" placeholder="Question Topic"><br>
<textarea rows="4" cols="50" id="content" name="content" placeholder="Content"><?php echo $content ?></textarea><br>
<input type="submit" value="Post">
<input type="hidden" name="q_id" value="<?php echo $q_id ?>">
<input type="hidden" name="type" value="question">
</form>
</div>
</div>
<script src="/script/master.js"></script>
<?php
mysqli_close($conn);
?>
</body>
</html>