I'm still working on things and I've almost got it done. The only issue I've got is in my jQuery code it don't send values to a php page. Ex: it should put "?whatever=whatever&soon=soon", but it don't. It leaves it blank.
I've tried changing code such as changing JS ids, and changing the code completely.
$(document).ready(function() {
var $userName = $("username");
var $text = $("text");
var $title = $("title");
var $chatSend = $("#chatSend");
function secret() {
var userNameString = $userName.val();
var textString = $text.val();
var titleString = $title.val();
$.get("./upload.php", {
username: userNameString,
text: textString,
title: titleString
});
window.location.replace("success.php");
}
}
I expected it to put in my values (to my MySQL table), but instead they're all blank.
Here's my form. (When clicked on chatSend, it does the jQuery functions.)
<div>
<input type="text" id="text" name="text">
<input type="text" id="title" name="title">
<input type="text" id="username" name="username" hidden value="<?php echo htmlspecialchars($_SESSION['username']); ?>">
<button id="chatSend">Send</button>
</div>
Also, here's the upload form now that I think about it (upload.php):
$user = $_GET['username'];
$title = $_GET['title'];
$text = $_GET['text'];
$query = mysqli_query($con, "INSERT INTO `blog` (username, title, text, view) VALUES ('$user', '$title', '$text', UUID())");