Added code to get comments from database

This commit is contained in:
2025-06-02 17:24:32 +01:00
parent 827924bd26
commit 5dc5d0c728
4 changed files with 165 additions and 1509 deletions

58
get_text_data.html Normal file
View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Form Submit Example</title>
<style>
textarea {
width: 100%;
height: 200px;
margin-top: 1em;
}
</style>
</head>
<body>
<form id="qidForm">
<label for="qidInput">Enter QID:</label>
<input type="text" id="qidInput" name="qid" required /><br />
<label for="survey">Survey: (SV_cwKjMqAqGxImjMG)</label>
<input type="text" id="survey" name="survey" required /><br />
<label for="Q1">Enter Q1:</label>
<input type="text" id="Q1" name="Q1" /><br />
<label for="Q2">Enter Q2:</label>
<input type="text" id="Q2" name="Q2" /><br />
<label for="Q3">Enter Q3:</label>
<input type="text" id="Q3" name="Q3" /><br />
<button type="submit">Get Counts</button>
</form>
<textarea id="output" readonly placeholder="Results will appear here..."></textarea>
<script>
document.getElementById('qidForm').addEventListener('submit', async function (e) {
e.preventDefault();
const formData = new FormData(this);
try {
const response = await fetch('get_text_data.php', {
method: 'POST',
body: formData
});
const text = await response.text();
document.getElementById('output').value = text;
} catch (error) {
document.getElementById('output').value = 'Error: ' + error.message;
}
});
</script>
</body>
</html>