Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-30-2012, 11:38 PM   PM User | #1
kristi
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
kristi is an unknown quantity at this point
Create, send, and read text from a file.

Hi!

I'll try to break this down as much as I can.

I want to create a website where the user answer a few questions, which gets saved to a textfile(not necessary a textfile, could be any file), for example:
Question: What time is it?
Answer: It's 6 pm.

How it would look inside the textfile:

What time is it?
It's 6pm.

Also, I want the user to be able to upload an image when answering a question, for example:
Question: Could you take a photo of your clock?
Answer: *uploads picture*.

How it would show up in the text file:

Could you take a photo of your clock?
*picture*.

Also, I want this to be saved to a file which can beaccessed later by an admin(for example), the admin would then be able to correct the answer, and send it back to the user.

Here's an example:

User login to his page(login function done), gets two options: "answer question" and "see corrected answers". When user chose the "answer question" option, he gets redirected to a page where he answers a few questions, the questions gets saved to a textfile, which the admin then will be able to see when logging in to his page and chosing "see questions answered by user". The admin select the option, reads the answers, correct them, and then sends them back to the user, who will be able to view them by choosing "see corrected answers".

Really grateful if anyone could help me with this!
//Kristi

Last edited by kristi; 12-02-2012 at 05:20 PM..
kristi is offline   Reply With Quote
Old 12-01-2012, 01:42 AM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,046
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Who is your webhost?

How much experience do you have with PHP, MySQL, JQuery, etc.



.
mlseim is online now   Reply With Quote
Old 12-01-2012, 02:39 AM   PM User | #3
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 446
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
May I ask why a text file, and not a database?

I'm curious because a text-file would be highly limited. You would have to submit lines of code into the text file so it could be pulled out and viewed on the web. For example you would have to upload the picture then send the code to either display the picture, or the url to the picture in the text file.

It might work, but would be especially limited when designing the physical look of your site.

Databases are much more secure. You never really want to have info stored in plain text where people can access it.
__________________
--
Thanks!
stevenmw is offline   Reply With Quote
Old 12-01-2012, 09:49 AM   PM User | #4
kristi
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
kristi is an unknown quantity at this point
Quote:
Originally Posted by stevenmw View Post
May I ask why a text file, and not a database?

I'm curious because a text-file would be highly limited. You would have to submit lines of code into the text file so it could be pulled out and viewed on the web. For example you would have to upload the picture then send the code to either display the picture, or the url to the picture in the text file.

It might work, but would be especially limited when designing the physical look of your site.

Databases are much more secure. You never really want to have info stored in plain text where people can access it.
I said a text file as an example, as I thought that it would be the easiest way. But yeah, a database could work.
kristi is offline   Reply With Quote
Old 12-01-2012, 10:11 AM   PM User | #5
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 446
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
DBs are very easy to utilize.

insert
http://www.w3schools.com/php/php_mysql_insert.asp

retrieve
http://www.html.net/tutorials/php/lesson20.php

(I prefer while loops when pulling data from DBs.)

If you look up content management system tutorials that would be a good source to learn alot. Those systems add, edit, and delete information from data bases through the use of html forms, and various PHP code.

That would demonstrate how to do it all in one tutorial.
__________________
--
Thanks!
stevenmw is offline   Reply With Quote
Users who have thanked stevenmw for this post:
kristi (12-02-2012)
Old 12-01-2012, 02:52 PM   PM User | #6
kristi
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
kristi is an unknown quantity at this point
Quote:
Originally Posted by stevenmw View Post
DBs are very easy to utilize.

insert
http://www.w3schools.com/php/php_mysql_insert.asp

retrieve
http://www.html.net/tutorials/php/lesson20.php

(I prefer while loops when pulling data from DBs.)

If you look up content management system tutorials that would be a good source to learn alot. Those systems add, edit, and delete information from data bases through the use of html forms, and various PHP code.

That would demonstrate how to do it all in one tutorial.
Thanks . Gonna try it out as soon as I get home.
kristi is offline   Reply With Quote
Old 12-01-2012, 03:12 PM   PM User | #7
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,046
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Bonzai ...

Start a new thread for your question, and be specific on what you need help with.
mlseim is online now   Reply With Quote
Old 12-01-2012, 03:29 PM   PM User | #8
Bonzai
New Coder

 
Join Date: Sep 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Bonzai is an unknown quantity at this point
how i can start ea new thread?
Bonzai is offline   Reply With Quote
Old 12-01-2012, 04:40 PM   PM User | #9
vinyl-junkie
$object->toCD-R(LP);


 
vinyl-junkie's Avatar
 
Join Date: Jun 2003
Posts: 3,054
Thanks: 2
Thanked 22 Times in 22 Posts
vinyl-junkie is on a distinguished road
I moved the post in question to a new thread.

Bonzai - To create a new thread here in the PHP forum, just click on the PHP link at the top of the page where it says CodingForums.com > Server Side Development > PHP. From there, click the New Thread link.

We now return you to your regularly scheduled discussion.
__________________
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
SNAP to it!
vinyl-junkie is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:01 AM.


Advertisement
Log in to turn off these ads.