Get submit button value in PHP

后端 未结 5 1532
天命终不由人
天命终不由人 2021-01-17 06:10

I would like to test my button can get the current value from the date\'s textbox? I got the value of submit button but I couldn\'t find any code get name of the button. So

相关标签:
5条回答
  • 2021-01-17 06:24

    If you'd like to get the value of 'oprf' above, then:

    $value = $_POST['obrf'];
    

    Should do it in php.

    0 讨论(0)
  • 2021-01-17 06:29

    You can try this one

    if(isset($_POST['oprf'])) {
     echo $_POST['oprf'];
    }
    

    Hope this helps

    0 讨论(0)
  • 2021-01-17 06:32

    Add type property with submit type="submit" to button tag this will submit the form then receive the form inputs value in php script with super global variable $_POST['input name'] or $_GET[] wdepends on from action property value by default GET.

    0 讨论(0)
  • 2021-01-17 06:39

    You can do:

    if ($_POST['oprf'] == '' || $_POST['oprf'] == NULL) {
    //this checks to see if there has been a value that was sent with the
    //form
    }
    

    I usually use isset for cookies.

    0 讨论(0)
  • 2021-01-17 06:42

    I don't think this works consitently in all browsers. Better to work with a customized name attribute.

    0 讨论(0)
提交回复
热议问题