Jump to content

Need help understanding how data is sent from a form


TomTees

Recommended Posts

Hey TomTees, I see you are still on this :)

 

Yep, I'm still in "dumb" mode this weekend!!

 

 

Checkout here, it may help you understand a little more.

 

Link: http://bytes.com/topic/php/insights/664241-using-html-forms-pass-data-php

 

Regards, Paul.

 

Thanks, but I have some questions...

 

(Sorry for being so obtuse, I'm so damn tired of spending weeks reading books only to forget what I read because I never have enough time to implement what I just learned.  I need to take a more "ask then do" approach until I get some momentum going...)

 

1.) So when you submit data from an HTML form, it is stored in an array called GET or POST depending on what you specified in form?

 

2.) And the GET or POST array is a "global" variable?  (Sounds scary and insecure upfront?!)

 

3.) And what pages can see these global arrays?

 

4.) When you submit the HTML form, the data is sent in the URL with GET, right?

 

5.) When you submit the HTML form, the data is secretly with POST, right?  Where is it again exactly?

 

6.) Data is sent to the "action" page you designated?

 

7.) So data is sent to the "action" page, or you are just routed there or what?

 

8.) If I was on some other non-action page, could I see what is in GET or POST?  (If so, what stops people from hi-jacking your data off the Internet?!)

 

9.) Can I assigned data to variables first in my HTML form, or must they be in the GET/POST arrays before they are submitted?

 

10.) Can my php code in the "action" page just echo what is in the GET/POST arrays?

 

11.) Can I assign values in the GET/POST arrays to a variable in my local "action" page?

 

12.) How do I avoid that ugly "undefined variable error" that I didn't understand last night?

 

Hope I don't get yelled at for all of these questions, but I am trying to *learn* how all this jazz works again, and it is related all to my original post.  Also, this is uch quicker than reading 3-4 chapters in my dusty PHP books!)

 

What I wouldn't give to be 20 again with a more elastic brain that learns quicker and retains better?!  ::)

 

Thanks,

 

 

TomTees

 

Link to comment
Share on other sites

P.S.  I think where I am getting hung up is that examples people posted online and from my dusty PHP book, because they just echo what you submitted in the form on the same page?!

 

The context of my original question is to get understand how you pass data entered into an HTML form on the user's computer to a PHP page (i.e. class) on a webserver and then pass that data to another PHP pgae (i.e. another class) on the webserver...

 

This whole Internet thing and how data is passed from user to server is still kinda foreign to me.

 

 

TomTees

 

 

Link to comment
Share on other sites

POST is sent in the header of the requested page.  Which is in the action attribute of the form.  To pass the POST variables to further pages, you must set those variables into either a COOKIE, or a SESSION variable.

 

In a nutshell, when you submit a form ( or click a link ), your computer sends a data packet to the server with the requested page's info.  If you clicked on a form submit button ( with action="post" ), it will also include a POST array, containing the values of the inputs, with the input names as the KEY in the POST array.

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.