Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    England
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Identifying the parameters in post strings

    If someone submits a form to blah.php, how can you identify the form names and parameters that have been posted, on that page ?
    \o/

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    foreach($_POST as $var=>$val)
    {
    echo 'form field named ' .$var. ' held value ' .$val. '<br />
    ';
    }
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    England
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    "form field named SubmitButton held value Go"

    It doesn't display the stuff I typed into the form boxes...

    \o/

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    England
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah never mind.

    I search for $_POST and basically what I needed to do was echo '$blah' if the name of the input box was blah
    \o/

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,095
    Thanks
    11
    Thanked 101 Times in 99 Posts
    unless you have a real old version of PHP <4.1 - get used to using

    $_POST['blah']; as opposed to $blah;

    else one day it will bite you in the behind.

    if Okii's code did not work it would be because your form fields were empty !
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •