forked from if-itb/IF3110-2015-T1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ask-question.php
68 lines (57 loc) · 2.09 KB
/
ask-question.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Stack Exchange</title>
<link rel="StyleSheet" href="css/style.css" type="text/css">
<script src="js/script.js"></script>
<?php
include 'dbfunctions.php';
$conn = ConnectToDatabase();
?>
</head>
<body>
<div id="header">
<h1> <a href ="question-list.php" style="color:#000"> Simple Stack Exchange </a> </h1>
</div>
<?php
if(!isset($_GET['edit'])) {
?>
<div class = "container">
<h2> What's Your Question? <hr> </h2>
<form method="POST" name="Form" action="add-question.php" onsubmit="return validateFormQuestion()">
<input type="text" name="question_name" id="question_name" placeholder="Name">
<br>
<input type="text" name="question_email" id="question_email" placeholder="Email">
<br>
<input type="text" name="question_topic" id="question_topic" placeholder="Question Topic">
<br>
<textarea name="question_content" id="question_content" rows="15" placeholder="Content"></textarea>
<br>
<input type="submit" id="submit_question" name="submit_question" value="Post">
</form>
</div>
<?php
}
else {
$edit = $_GET['edit'];
$question = GetQuestion($edit);
?>
<div class = "container">
<h2> What's Your Question? <hr> </h2>
<form method="POST" name="Form" action="edit-question.php?id=<?php echo $edit ?>" onsubmit="return validateFormQuestion()">
<input type="text" name="question_name" id="question_name" placeholder="Name" value="<?php echo $question['question_name'] ?>">
<br>
<input type="text" name="question_email" id="question_email" placeholder="Email" value="<?php echo $question['question_email'] ?>">
<br>
<input type="text" name="question_topic" id="question_topic" placeholder="Question Topic" value="<?php echo $question['question_topic'] ?>">
<br>
<textarea name="question_content" id="question_content" rows="15" placeholder="Content"><?php echo $question['question_content'] ?></textarea>
<br>
<input type="submit" id="edit_question" name="edit_question" value="Post">
</form>
</div>
<?php
}
?>
</body>
</html>