corbin Posted December 28, 2008 Share Posted December 28, 2008 Loads fine for me. Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-724980 Share on other sites More sharing options...
Mchl Posted December 28, 2008 Share Posted December 28, 2008 Working now. Don't know why it didn't the first time. Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-724985 Share on other sites More sharing options...
oriental_express Posted December 28, 2008 Author Share Posted December 28, 2008 Working now. Don't know why it didn't the first time. Thats great, so yeah.....it works. Now thats been done I've practically finished 80% of the project (software wise) and only completed 20% of written work. I just gotta touch up on extra stuff like formating the html, thinking of a good way to display an answer either to produce a new page or just simply echo the answers underneath..not sure if thats gonna be neat with the radio buttons etc. Now I just got to do my project write up. Massive weight of my shoulders now. I've been thinking of the sessions.......this I would like to implement as collecting information would be useful to a non programmer that might use this script for their own exper system. I'll be around to update Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-724989 Share on other sites More sharing options...
oriental_express Posted January 17, 2009 Author Share Posted January 17, 2009 Hi there everyone. I finished my exams and now concentrating on this project ready for hand in on 1st May. I been thinking that I would like to display the previous question but I have a feeling that I will need some ajax component, this will be slightly more difficult. Is there any other easier way to do this considering the time I have left ? I can't see it happening without the use of ajax. Could anyone confirm please. http://minhtri-nguyen.com/tree.php http://minhtri-nguyen.com/questions.csv Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739388 Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 It is entirely possible to display previous question (and answer to it) without AJAX. Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739644 Share on other sites More sharing options...
oriental_express Posted January 18, 2009 Author Share Posted January 18, 2009 It is entirely possible to display previous question (and answer to it) without AJAX. Thats greate !! This is what I'd live to accomplish This is an example on the NHS website http://www.selfhelpguide.nhs.uk/help/bodykey/questions/index.aspx?nodes=FlgWPcj%2f1Ow%3d Is it possible to dispall ALL previous questions and answers to it ? Where should I start looking ? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739828 Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 Now this is where you could use sessions at last This is what I'd live to accomplish This is an example on the NHS website http://www.selfhelpguide.nhs.uk/help/bodykey/questions/index.aspx?nodes=FlgWPcj%2f1Ow%3d Oh my! It's asking me about my vagina! Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739906 Share on other sites More sharing options...
oriental_express Posted January 18, 2009 Author Share Posted January 18, 2009 This is what I'd live to accomplish This is an example on the NHS website http://www.selfhelpguide.nhs.uk/help/bodykey/questions/index.aspx?nodes=FlgWPcj%2f1Ow%3d Oh my! It's asking me about my vagina! lol try it on other body parts. Its an exellent example cause your even able to correct previous questions and then go down a different tree path. Where should i be looking to just display all previous questions ? Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739932 Share on other sites More sharing options...
Mchl Posted January 18, 2009 Share Posted January 18, 2009 Each time you display a question, you should store it in session. Once you get the answer for that, it should also go into a session. When you display second or later question, you also display all questions and their answers stored in session. Walk in the park (after dark). Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739948 Share on other sites More sharing options...
oriental_express Posted January 18, 2009 Author Share Posted January 18, 2009 Each time you display a question, you should store it in session. Once you get the answer for that, it should also go into a session. When you display second or later question, you also display all questions and their answers stored in session. Walk in the park (after dark). thank you mchl, let me see what i can cough up. Might be a while thanks again ! Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-739989 Share on other sites More sharing options...
oriental_express Posted February 2, 2009 Author Share Posted February 2, 2009 Hi there again I'm back I hope everyone is ok! Ok I last said that I wanted to use sessions to track answers but I think I want to put that on the back burner for a minuite as I think I need to implement something more important. Remember we talked about editing a CSV file and then just up load it ? Trouble is that it requires ftp log in which is kinda of a hassle. With suggestion from my tutor I am now going to use a web interface that will be able to add delete edit values. For now I am stuck. File form.php <?php $file = fopen("questions.csv", "r"); while ($data = fgetcsv($file, 1000)) { $questions[]= $data; } fclose($file); ?> <form action="save.php" method="post"> <p><br> Line no. <input type="text" value="<?php echo $questions[0][1]; ?>" size="15" name="save" /> <p> Questions <input type="text" value="<?php echo $questions[0][2]; ?>" size="15" name="save" /> <p> Answer 1 <input type="text" value="<?php echo $questions[0][3]; ?>" size="15" name="save" /> </p> <p>Answer 1 Line no. <input type="text" value="<?php echo $questions[0][4]; ?>" size="15" name="save" /> </p> <p>Answer 2 <input type="text" value="<?php echo $questions[0][5]; ?>" size="15" name="save" /> </p> <p>Answer 2 Line no. <input type="text" value="<?php echo $questions[0][6]; ?>" size="15" name="save" /> </p> <p> <input name="SUBMIT" type="SUBMIT" value="Edit File" /> <input name="RESET" type="RESET" /> </p> </p> </FORM> The above echos a form of the data values in textfield from a csv file. When a user edits the file all s/he does is clicks edit which should re edit the csv file. File save.php for now I have <?php $file = fopen("questions.csv", "w"); while ($data = fgetcsv($file, 1000)) { $questions[]= $data; } fwrite($file, $_POST['save']); fclose($file); header('Location: http://127.0.0.1/Tree/phptextedit/form.php'); ?> I know that is incorrect because it wipes out the whole csv file and replaces it with only one of the edit values from the form. ie its not editing properly. What is confusing me is when we do "$questions[]= $data;" this is all loaded into memory but how would do it so that a file knows whats whats ? How does a fa CSV file know [ 0][1] is ? I was thinking of doing something along the lines of if ($questions[0][1] == $_GET['save']) && ***** [0][1] of CSV file ***** { fwrite($file, $_GET['save']); ***** [ 0][1] of CSV file ***** thats where I have a problem ? First of all can such a thing be done ? Is this the right step ? I appreciate if someone could guide me as Im not interested in direct answers. Thank you again. Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-752291 Share on other sites More sharing options...
Mchl Posted February 2, 2009 Share Posted February 2, 2009 Sorry, don't really have time to anlyze your code right now. I would however try a different approach. 1. Create a HTML form with textarea and submit button. 2. Use file_get_contents to load whole CSV into php variable and display it in HTML textarea 3. Edit the contents of textarea 4. After clicking 'Submit' save whole content of textarea to CSV file. This would be the simplest approach IMHO, but would not be foolproof. (i.e. when someone forgets to put a comma between fields, ot does some other error, the resulting CSV file will be corrupt - but repairable ) Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-752293 Share on other sites More sharing options...
oriental_express Posted February 2, 2009 Author Share Posted February 2, 2009 Sorry, don't really have time to anlyze your code right now. I would however try a different approach. 1. Create a HTML form with textarea and submit button. 2. Use file_get_contents to load whole CSV into php variable and display it in HTML textarea 3. Edit the contents of textarea 4. After clicking 'Submit' save whole content of textarea to CSV file. This would be the simplest approach IMHO, but would not be foolproof. (i.e. when someone forgets to put a comma between fields, ot does some other error, the resulting CSV file will be corrupt - but repairable ) Thank you for your reply but my problem with that approach is that it kinda distorts the way it looks in the textarea, one line might have more text then the other and it condenses and makes it hard to work out with column belongs to which. Is there such thing as making columns in a textarea ? thank you Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-752297 Share on other sites More sharing options...
oriental_express Posted October 12, 2009 Author Share Posted October 12, 2009 Hello everyone I finished my project in May and I graduated with a 1st class Degree in BSc Computing. Woohoo Now I'm back for my MSc. Thank you to everyone who contributed especially MCHL! I remember reading that someone wanted a tutorial to be made out of this on how to use CSV files to display information in an expert system manner. Here it is working http://www.phpexpertsystem.com/computer/ I couldn't figure out how to "end" the decision tree properly. MCHL Let me know if you have to time to do this as I'm swamped for work :'( or I could just post up the code? Best regards Michael PS thank you very much! Much appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-935536 Share on other sites More sharing options...
Mchl Posted October 12, 2009 Share Posted October 12, 2009 Congratulations! I would very much like to see the code if you don't mind uploading it somewhere (can you attach files here in forums?) Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-935582 Share on other sites More sharing options...
oriental_express Posted October 16, 2009 Author Share Posted October 16, 2009 Hi all, I have left it as an attachment, and instruction manual for download: http://phpexpertsystem.com/instructions.doc Thanks MCHL [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/134533-final-year-project-please-point-me-in-the-right-direction/page/5/#findComment-937980 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.