+ Reply to Thread
Results 1 to 2 of 2

Thread: How to Post Dyanmic Data

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    36

    How to Post Dyanmic Data

    I have two php Pages : Main and Download
    Main :
    Code:
    echo"<form action='download.php' method='post'>"
    for(i = 0; i < 10; i++){
        echo"<input type='submit' name='$i'>";
    }
    In the other page which is download , i`d like to know which button was pressed from 1 to 10.

    That code didn`t work for me.

  2. #2
    You can use the following method :
    Code:
    foreach ($_POST as $key => $val) {
      if (ctype_digit($key)) {
        echo "You clicked $key";
        // Access it via $_POST[$key]
      }
    }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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