Web Analytics Made Easy -
StatCounter Using $_POST - CodingForum

Announcement

Collapse
No announcement yet.

Using $_POST

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using $_POST

    Hi,

    I'm having problems using $_POST.

    In the html form the 'name' is

    name = "fromdate[mday]"

    I am trying to use this variable. The way I have tried it is not working. This is what I have got

    PHP Code:

    $_POST
    [fromdate[mday]]; 
    Does anyone know how I can get this to work?

    Thanks

  • #2
    Have you tried using double quotes?

    $_POST["fromdate[mday]"];

    TBH I can't see why you've named your form field that way, is there a specific reason?

    Comment


    • #3
      if that doesnt work perhaps you are using an older version of PHP and need to use $_HTTP_POST[]?

      Is that right? I've only ever used $_POST[].

      It is probably because you have two sets of []
      Dave

      Comment


      • #4
        Re: Using $_POST

        Since you didn't give us much to go on I will have to assume you are trying to use a checkbox array using specific keys?

        Something like this maybe?

        PHP Code:

        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
        <input type="checkbox" name="book[dogs]" value="Benji" />
        <input type="checkbox" name="book[dogs]" value="Lassie" />
        <input type="checkbox" name="book[dogs]" value="Old Yeller" />
        <input type="submit" name="submit" value="Submit" />
        </form>
        and then to access that checkbox array using a specific key would go like this:

        PHP Code:

        <?php
        if(isset($_POST['submit'])){
            echo 
        $_POST[book][dogs];
        }
        ?>
        If that is the case then you should simply need to change this:

        $_POST[fromdate[mday]];

        to this

        $_POST[fromdate][mday];
        Spookster
        CodingForum Supreme Overlord
        All Hail Spookster

        Comment


        • #5
          works!

          Thanks guys, I got it working!

          Comment


          • #6
            Yes , u r right.

            Comment

            Working...
            X