psjtk Posted February 19, 2013 Author Share Posted February 19, 2013 ftp://psjtk@measured-response.com@measured-response.com/study-info/demogstore.php Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 19, 2013 Share Posted February 19, 2013 Notice what's missing? Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 19, 2013 Author Share Posted February 19, 2013 Hi Jessica, I'm pretty new at this, so if it's a stupid error - fine, I accept that. I have absolutely no idea what's missing - been at this for several days. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 Move the study-info to wp-content, I think this the public folder in word press. Then try, http://measured-response.com/study-info/demogstore.php Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 19, 2013 Author Share Posted February 19, 2013 Hi jazzman, these files are not meant to be for the wordpress site - I wrote a couple of html documents linked together that I want people to go through before the last one links them to my wordpress site. That means these are standalone pages. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 19, 2013 Share Posted February 19, 2013 ftp://psjtk@measured-response.com@measured-response.com/study-info/demogstore.php  http://measured-response.com/leeds/study-info/demogstore.php  There is one directory layer difference between these two: measured-response.com/leeds/study-info/demogstore.php measured-response.com/study-info/demogstore.php Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 Hi jazzman, these files are not meant to be for the wordpress site......... Â Then, rid of the study-info directory from the word press folder. Â What's the name of the web root server directory? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 19, 2013 Share Posted February 19, 2013 It appears the wordpress directory is the webroot. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 It appears the wordpress directory is the webroot. No, it's impossible only the index is there. Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 19, 2013 Author Share Posted February 19, 2013 re: one layer of difference - that is really strange and I am not sure why - all the files are in the com/leeds/study-info/ directory but for some reason the ftp urls of all the files in that directory give com/study-info/ leaving out one layer. Â When I want to access the files I use the .....com/leeds/study-info/file.html url and that allows me to access the first html file from which I then move in succession through all the other html files so the server seems to retrieve those without a problem. Â Even the error that says that the php file isn't found is reporting the correct path to it so it seems that the server is looking in the right location (com/leeds/study-info/). Could it be an ftp issue then and is there something I can do to change what my ftp client thinks is the url-path? Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 (edited) According that one - com/leeds/study-info/ , your web root directory is called "com" . Â Just move the study-info there. Â PS. Do you see any index file in the "com" directory? Edited February 19, 2013 by jazzman1 Quote Link to comment Share on other sites More sharing options...
dodgeitorelse3 Posted February 19, 2013 Share Posted February 19, 2013 (edited) well I see in one of OP's first posts he says error is 18-Feb-2013 12:04:13 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/measured/public_html/leeds/study-info/demogstore.php on line 12  but in his Screenshot for firebug it is saying /home/measured/leeds/study-info/demogstore.php  notice the public_html? of course I could be way off base here lol Edited February 19, 2013 by dodgeitorelse3 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 He-he-he, good eye Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 19, 2013 Author Share Posted February 19, 2013 Hi Jazzman, that's a good idea. I don't have access to the .com directory - I'm asking the server owner for permission. I'll move the /study-info folder there and let everyone know what happens. Â @Dodge The error I posted previously is from the error log on my server but it's old. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 19, 2013 Share Posted February 19, 2013 Hi Jazzman, that's a good idea. I don't have access to the .com directory - I'm asking the server owner for permission. I'll move the /study-info folder there and let everyone know what happens. Â @Dodge The error I posted previously is from the error log on my server but it's old. Â I'm really confused what is the name of your web root directory of the server. Â Just, phone and ask them for details that you need to know. Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 20, 2013 Author Share Posted February 20, 2013 (edited) So just to update everyone on what happened. This is a project I'm working on at a university. The server is owned by someone who has allowed me to use it for this project, but I don't have access to the web root directory. Â So, I uploaded the the files to a new server in the web root directory. I no longer have the issue that Jessica and everyone else pointed to, re: the missing of a layer in the path. I'm reposting my code below: Â 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 demogs = [[age, freq, time, eng]]; var JSONdemogs = JSON.stringify(demogs); var postArray = {timestamp:timestamp, json:JSONdemogs}; $.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) } ) }; Â This is the PHP file, with the assoc parameters set to TRUE as AyKay recommended. Â <?php // decode JSON string to PHP object $timestamp = json_decode($_POST["timestamp"]); $decoded = json_decode($_POST["json"], true); $fp = fopen('PHP_data/'.$timestamp.'_data.csv', 'a'); foreach ($decoded as $fields) { fputcsv($fp, $fields); } fclose($fp); ?> Â The PHP file now creates the .csv files, but my issue is that the csv files are now empty. It's not posting the values it gets from the HTML file. Â Here is the error I get from my server: Â [20-Feb-2013 03:38:10] PHP Warning: Invalid argument supplied for foreach() in /home1/asthmavi/public_html/demogstore.php on line 12 Â Any ideas? Thank you again, everyone who has been trying to help. Edited February 20, 2013 by psjtk Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 20, 2013 Author Share Posted February 20, 2013 Also, I double checked my permissions - everything is set to "read, write, and execute." Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 20, 2013 Share Posted February 20, 2013 We need to see what result you get. Â Put it this after you've been assigned the $decoded variable. Â echo '<pre>'.print_r($decoded, true).'</pre>; Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 20, 2013 Author Share Posted February 20, 2013 Hi jazzman, I inserted the code as you suggested. Â <?php // decode JSON string to PHP object $timestamp = json_decode($_POST["timestamp"]); $decoded = json_decode($_POST["json"], true); echo '<pre>'.print_r($decoded, true).'</pre>; $fp = fopen('PHP_data/'.$timestamp.'_data.csv', 'a'); foreach ($decoded as $fields) { fputcsv($fp, $fields); } fclose($fp); ?> Â It creates a syntax error: Â [20-Feb-2013 05:14:04] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home1/asthmavi/public_html/demogstore.php on line 10 Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted February 20, 2013 Share Posted February 20, 2013 You are missing a closing single quote after </pre>. Now you are just getting sloppy. Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 20, 2013 Author Share Posted February 20, 2013 ::smacks head:: thanks AyKay. Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 20, 2013 Author Share Posted February 20, 2013 Okay, I'm getting the foreach error again: Â [20-Feb-2013 05:39:37] PHP Warning: Invalid argument supplied for foreach() in /home1/asthmavi/public_html/demogstore.php on line 13 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 20, 2013 Share Posted February 20, 2013 Ops.....sorry for my previous mistake. Â Try, Â <?php // decode JSON string to PHP object $timestamp = json_decode($_POST["timestamp"]); $decoded = json_decode($_POST["json"], true); echo '<pre>'.print_r($decoded, true).'</pre>'; exit; $fp = fopen('PHP_data/'.$timestamp.'_data.csv', 'a'); foreach ($decoded as $fields) { fputcsv($fp, $fields); } fclose($fp); Quote Link to comment Share on other sites More sharing options...
psjtk Posted February 20, 2013 Author Share Posted February 20, 2013 Okay, so now I no longer get the error from my server, but the PHP file doesn't create the csv file anymore. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 20, 2013 Share Posted February 20, 2013 Okay, so now I no longer get the error from my server, but the PHP file doesn't create the csv file anymore. Â Yes, I know.....just let us see the data from a $decoded variable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.