I am using this AJAX Image Uploader script and what I am trying to do is pass a hidden variable.
<input type="hidden" name="test" value="test" />
But since there is no real submit button, it is all AJAX based, I cannot just call $_POST['test'];
Part of the jQuery is:
if (formdata) {
$.ajax({
url: "upload.php",
type: "POST",
data: formdata,
processData: false,
contentType: false,
success: function (res) {
document.getElementById("response").innerHTML = res;
}
});
}
It should probably go somewhere in there but I’m not sure on how to approach this. If anyone has any suggestions I would really appreciate it.
Thank you!
Try this:
Just give your hidden input an id so we can refer to it and get the value. I used
hidden_inputin this case.Then your
upload.phpshould be able to access the value with$_POST['test']