How do I get the value of a radio button in PHP?

后端 未结 5 944
遇见更好的自我
遇见更好的自我 2021-02-12 14:09

I\'ve created a basic website that requires the user to select a radio button. I want a PHP file to retrieve the value of the radio button that was chosen and respond accordingl

5条回答
  •  我在风中等你
    2021-02-12 14:39

    This is the form that's being submitted. It has an action attribute which directs it to Result.php.

    //This button opens Result.php

    In order for you to get the data you want in Results.php, you need to add the radio buttons to this form

    First
    Second

    You're also going to need to change your method to POST if you're going to use the $_POST superglobal

    $radioVal = $_POST["MyRadio"];
    

提交回复
热议问题