Thread: PHP Form POST

Page 3 of 3 First 123
  • Jump to page:
    #31
  1. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,002
    Rep Power
    376


    PHP Code:

    $str 
    =      '<table border=1 cellpadding=3 width="500">'

    foreach ( 
    $_POST as $k => $v ) { 
      
    $str .= "<tr><td><b>{$k}</b></td><td>{$v}</td></tr>";
      
    $k .= ucwords($k); //why keep on "adding" to k? should this not be BEFORE the str.= part? otherwise what exactly are you doing with this..

    $str .= '</table>'
    Originally Posted by ultramel123
    Thank you,

    Ok I see now what you are referring to (I think).

    $k refers to the "field name" (not sure on term)
    $v refers to the value which is POSTED?

    I have changed it to this:

    PHP Code:
    $str =      '<table border=1 cellpadding=3 width="500">'
                   foreach ( 
    $_POST as $k => $v ) { 
                   
    $str .= "<tr><td><b>{$k}</b></td><td>{$v}</td></tr>";
                   
    $k .= ucwords($k);
                   } 
                   
    $str .= '</table>'
  2. #32
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    27
    Rep Power
    0
    Thank you

    I have moved it to before $str. it's now working, except the "lowercase version" appears first and then the uppercase version right next to it.

    I cannot see where I am going wrong. If I remove $k from the 'foreach' line, then it no longer works at all.


    PHP Code:
    $str =      '<table border=1 cellpadding=3 width="500">'
                   foreach ( 
    $_POST as $k => $v ) { 
                   
    $k .= ucfirst($k);                 
                   
    $str .= "<tr><td><b>{$k}</b></td><td>{$v}</td></tr>";
                   } 
                   
    $str .= '</table>'
  4. #33
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    27
    Rep Power
    0
    i removed the "." and it is working now..

    PHP Code:
    $str =      '<table border=1 cellpadding=3 width="500">'
                   foreach ( 
    $_POST as $k => $v ) { 
                   
    $k ucfirst($k);                 
                   
    $str .= "<tr><td><b>{$k}</b></td><td>{$v}</td></tr>";
                   } 
                   
    $str .= '</table>'
    Thank you for your help
Page 3 of 3 First 123
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo