Jump to content

PHP Beginner- in school- HORRIBLE Teacher- I am lost!!! HELP!


LostinSchool

Recommended Posts

I am taking beginner Javascript and PHP at the same time. I understand Javascript but am NOT getting PHP at all. The teacher is horrible- I have basically had to teach myself everything on my own. We have a take home test and I am freaking out because I don't even know where to begin. The assignment is to create a form in HTML or javascript (which is fine- I'm ok with that part) But then I need a submit button which saves the data from the form in a text file, AND I need a link for opening a document that displays the items that were submitting using the form. Can someone give me a sample code? This is due tomorrow so answer ASAP! Thanks!!!

Link to comment
Share on other sites

Just to clarify- I appreciate any kind of help anyone can offer- either a sample code, or even a link to a tutorial that shows how to do that (if anyone out there can just point in the right direction I would really really really appreciate it!) I am just majorly freaking out! ???

Link to comment
Share on other sites

Obviously, ya misinterpreted somethin

 

Create a form

submit action shud save the form data to a txt file

not submit button, as javascript/html dusn have access to the server.

 

so u sould have

the form page

the form processing page (after processing, remember show them some confirmation or redirect to another page)

and validation page(Shows what u entered, this could be the with form processing)

 

 

and we dont do homework for ppl.

u write code or toss ideas how it shud work

and we respond in kind

 

if we gave u the answers, u wudn learn anything

Link to comment
Share on other sites

Thanks so much for trying to help me!!! I really really do appreciate it. I am not looking for you to do my homework for me... but I'm telling you I am in tears right now because I have been reading this book for the past like 7 hours and it is just not sinking in. My teacher hasn't taught me ANYTHING... that's why I'm here. I don't get it, and even your response might as well have been in Chinesebecause I don't really understand it. Is there anyway you can tell me a sample of the code one would use that would submit this form to a text file? Or at least just the function or whatever its called?

 

Oh and on a sidenote, the whole time I've been in class I have never even used Apache because we are blocked from downloading it on our computers at school, so there is no way to even check our work. And I wasn't able to download it at home... so that is part of the reason I am so lost. I honestly just want to get through this class and move on and never do PHP again in my life!!!!!! If there was something Icould help you with in return I would! I'm desperate....

 

Thanks so so so much.

Link to comment
Share on other sites

PHP is a processing lanuage

and its quite simple to test the script without a web server.

 

But if U have a usb key, U can build a development environment for php.

 

I have everything but mysql on my usb key,

with php, quickphp (a development webserver), and devphp (a php editor)

 

I wud say, first build your form.

 

than work on getting the variables from the form (even if its for display), this will show u yer form is working proper, and that the processing script is getting the variables.

 

once u verify this, u can remove the display portion, and process the form data, in your case save it to a file.

 

than final step is showing the overview of the data, like a spreadsheet (use tables), so a user can select which data to display

 

and finally the display portion.

 

the form u shudn have any problem, but its the start of the whole project

the rest is just processing.

 

we point, u read, and think and give ideas and sample code

 

we can fix, refine, suggest.

 

 

Link to comment
Share on other sites

Thanks- I will try to interpret what you said the best I can... I would post sample code but like I said I have no idea what the functions or code things even are. I am a graphic design major so as you can see there is not much use for this stuff.  At this point I just want to pass but it looks like that probably isn't happening. Looks like its gonna be an all nighter for me. My javascript take home took me 3 hours to do and I'm sure this will take me even longer.... and I'm also sure its something you guys can do in 5 minutes!! Thanks for tryin :) I appreciate it.

 

Kate

 

 

Link to comment
Share on other sites

I can tell u almost exactly wut u will need for php.

 

u can use php.net, to read on how they work, and examples

 

u will need $_POST/$_GET variables

$_POST is used with form method "post" which most forms use

$_GET is used on the uri, like http://www.google.com?q=tutorials

 

u can use fopen/fwrite/fclose or my preferred functions of file_get_contents/file_put_contents.

 

thats pretty basicly all the functions u need for the php script.

 

but u still need the code to handle the processing (if/else)

 

 

Link to comment
Share on other sites

Well its not the submit, that just sends something to the server

its the other form elements you use for your data.

 

if this was not explained, or wut data to use. U can prolly come up with a few idea

 

Address Book - Name Address City State Zip

Reciepes - Name, ingrediants, instructions

etc

etc

etc

 

so either follow the assignment, if it doesnt limit u to what, than come up with something

Link to comment
Share on other sites

you are really great for helping me! I also looked into some tutorials... I found this code:

 

<?php

$Name = addslashes($_POST["name"]);

$Department = addslashes($_POST["department"]);

$Position = addslashes($_POST["position"]);

 

Will that post it to the text file or just in another browser?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.