Search code examples
phpsuperglobals

Supersimple SuperGlobal PHP form information needed


Just looking for some clarification, as I am still new to all of this:

I have created a rudimentary CMS. We now have to redesign it to allow for an image upload. When I use my original form which I was grabbing all of my POST info from, can I update it to send $_FILE info as well, or do I need a separate form?

In other words, when submitting a form, does php create info for all superglobals, or do you need a different form for each?


Solution

  • PHP imports all the elements of your form. You just need to access them using superglobals. for example $_POST['name'] stores the value of the name field in the form and $_POST['age'] stores the value of the age field in the form. You can now save these to your db in the same script.