Hi, I have an html page with a form that people fill out and when they press ‘submit’ I use a POST php method to save the information they entered onto a .csv file in the directory in my server. The php code is in a separate file that I call from the HTML page. However, I’m getting a 404 error saying that the php file which handles all that input cannot be found.
THIS IS THE JAVASCRIPT ON THE HTML DOCUMENT THAT GETS ALL THE VALUES FROM THE FORM WHEN THE SUBMIT BUTTON IS PRESSED:
//FUNCTION: Button press
var demogCont = function(){
var timestamp = new Date().getTime();
var age = document.getElementById('age').value;
var freq = document.demographics.item1.value;
var time = document.demographics.item2.value;
var eng = document.demographics.eng.value;
var email = document.demographics.email.value;
var demogs = [[age, freq, time, eng, email]];
var JSONdemogs = JSON.stringify(demogs);
var postArray = {timestamp:timestamp, json:JSONdemogs};
if (document.demographics.email.value.length > 0){
$.post("demogstore.php", postArray,
function(){
window.open('demographics2.html?demog=true&ts='+ timestamp,'_self',false);
}
)
.error(
function(){
alert('Communication error with server.');
window.open('demographics2.html?demog=true&ts='+ timestamp,'_self',false)
}
)
}
};
THE PHP FILE LOOKS LIKE THIS
[php]
The file path and the file name are correct. Does anyone know what could be causing this error?