Saturday, April 17, 2010

ADV. WEB ONLY - Monday - MANDATORY Q

This post is for Advanced Web Students only.

Mandatory Question(s) of the day ...

During the last week I spent quite a bit of time helping many of you troubleshoot errors in your scripts. During our debugging efforts, I would try to informally gauge your overall understanding of some "big picture" things.

Variables are a "big picture" thing; making html forms are "big picture" ...

Q: By now you've probably seen a line of code like the one below scores of times:
$guess = $_POST['guess'];

Break this line of code down - explain each part and how they connect to each other.
(i.e. How is $guess related to 'guess' ... why did we need to type in $_POST? Do we usually see this line of code on a form page or on a handle_form page?)




18 comments:

  1. $guess = $_POST['guess'];

    One would usually see the above script when recreating a variable from an html form onto a php.
    $guess is the receated, or transfered variable and it is equal to ['guess']. = $_POST is telling $guess to go into the POST to find ['guess'].

    ReplyDelete
  2. $guess = $_POST['guess'];

    I remember using this for creating a varible from html to a php. Thats all I know... :/ -Nate C.

    ReplyDelete
  3. $guess = $_POST['guess'];

    I remember using this for creating a varible from html to a php. Thats all I know... :/ -Nate C.

    ReplyDelete
  4. $guess = $_POST['guess']

    the first part is a new variable you are naming, the = means it is equal to the variable typed 'guess' on the last page, and the $_POST means you want it to be avaliable (its value), but you don't want to see its value in the url.

    It is seen on a handle form page.

    -Melissa Scenga

    ReplyDelete
  5. $guess is what we name the variable
    $_POST is the action and what were telling it to do
    ['guess'] is what we called the variable on the original page

    ReplyDelete
  6. I don't remember how they use this form but if i study i can nod.
    $guess= $_POST['guess'];
    -Nelson Mandela

    ReplyDelete
  7. $guess is the variable from the html page that will show the word or phrase typed in box of some sort. $_POST is what carries that variable from the html page to the next php page. and it is making $guess look for 'guess'.-William Hundt

    ReplyDelete
  8. $guess and 'guess' have the same values. $_POST is what makes $guess work because it goes in and retrieves information from your original form. (In this example, it goes in and finds information with a value of 'guess' from an html form page.)

    We see this line of code on a handle_form page.

    --Sarah Kimmel

    ReplyDelete
  9. im not sure i cannot remember something to do with transformation of variables i don't speak computer so

    ReplyDelete
  10. $guess is the variable and it is equal to "guess". $_POST means that your getting it from POST, your other page. And ['guess'] is where your getting your info from.

    ReplyDelete
  11. $guess = $_POST['guess'];

    $guess is a variable, the equals is what your telling it to do which is posting it, ['guess'] is equal to the $guess variable.
    I dont know if this makes much sense but this is how ive always thought it works.
    -Chris Pfeifer-

    ReplyDelete
  12. $guess= $_POST['guess]

    $guess is the variable and it is equal to ['guess']. = $_POST is telling $guess to go into the POST to find ['guess'].

    We usually see this line of code on a handle_form page. ~Morgan McCoy

    ReplyDelete
  13. $guess isi would have to put the name variable
    $_POST is the action and what were telling it to do
    ['guess'] is what we called the variable on the original page
    Chris Lowure.....

    ReplyDelete
  14. $guess is the variable
    Post is the action
    [guess] is what its finding.
    -Ashlee Smith

    ReplyDelete
  15. $guess = $_POST['guess']

    I think that this is used when creating a variable when going from html to php.
    - Tim Blake

    ReplyDelete
  16. $guess= $_POST['guess'] $guess is the variable post the action [guess]what its going to find o print
    -Jose pena

    ReplyDelete
  17. $guess = $_POST['guess'];

    $guess is a variable.
    $_POST is the action the variable is going to take.
    ['guess'] is the variable carried from the original page.

    - jillian janis

    ReplyDelete
  18. $guess is what we name the variable
    $_POST is the action and what were telling it to do
    ['guess'] is what we called the variable on the original page
    - Jaylen Fuentes

    ReplyDelete