-
Notifications
You must be signed in to change notification settings - Fork 0
/
form-answer.php
67 lines (56 loc) · 2.05 KB
/
form-answer.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Answer Form</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,300italic' rel='stylesheet' type='text/css'>
</head>
<body>
<header>
<a href="./index.php"> <img id="logo" src="logo.png" alt="Quora"/> </a>
</header>
<?php
session_start();
if(isset($_SESSION["loggedin"])) {
?>
<a href="./form-question.php"><img src="FAB.png" alt="Submit a question" title="Submit a question" id="FAB" /></a>
<?php
$qid = $_GET["qid"];
require_once('mysqli-connect.php');
$qid = $_GET["qid"];
$sql = "SELECT * FROM Questions WHERE id=" . $qid;
$response = $conn->query($sql);
if(mysqli_num_rows($response) > 0) {
?>
<h1 id="form-title" class="center">Submit an Answer</h1>
<div class="center" id="submit-section">
<form class="center" id="submit-form" onsubmit="return validateQA()" action=<?php echo "./answer.php?qid=" . $qid ?> method="post" enctype="multipart/form-data">
<label id="error_msg" class="err_msg"></label>
<label class="small_err" id="url_err"></label>
<input type="url" name="url" id="site-url" placeholder="Enter website URL"><br>
<br />
<textarea rows="10" cols="40" id="textform" name="text" placeholder="Enter your answer here (at least 30 characters)"></textarea> <br />
Character count: <label id="charCount">0</label>/300
<br />
<input type="submit" id="submit-button" name="question-submit" value="Submit"><br>
</form>
</div>
<?php
} //end if
else {
?>
<div class="center post-display" id="submit-section">Error: invalid question ID.</div>
<?php
} //end else
} //end if
else {
?>
<div class="center post-display" id="submit-section">You must be logged in to view this page.</div>
<?php
}
?>
<script type="text/javascript" src="script.js"> </script>
<script type="text/javascript" src="script-QA.js"> </script>
</body>
</html>