简体   繁体   English

在单选按钮的选定值上获取html表格

[英]on selected value of radio button get html form

I have two registration HTML form for Student and College . 我有两个适用于StudentCollege的注册HTML表单。 Initially, I have two radio buttons of Student and College. 最初,我有两个学生和大学单选按钮。 If I select Student I'll get student registration form or if I select College I'll get college registration form also I want to insert that value of radio button to the database. 如果我选择“学生”,我将获得学生注册表格,或者,如果我选择“大学”,我还将获得大学注册表格,我也想将该单选按钮的值插入数据库。 I'm unable to understand how should I start. 我不知道该如何开始。 I'm using PHP and MySQLi technology. 我正在使用PHP和MySQLi技术。 Please help me with this? 请在这件事上给予我帮助?

<div class="col-lg-6">
    <h5>Whether College/Student?</h5>
    <div class="form-group form-check-inline">
        <label class="custom-control custom-radio">
            <input id="radio" name="radio" value="0" type="radio" class="custom-control-input">
            <span class="custom-control-indicator"></span>
            <span class="custom-control-description">College</span>
        </label>
    </div>
    <div class="form-group form-check-inline">
        <label class="custom-control custom-radio">
            <input id="radio" name="radio" value="1" type="radio" class="custom-control-input">
            <span class="custom-control-indicator"></span>
            <span class="custom-control-description">Student</span>
        </label>
    </div>
</div>

First of all you need a form. 首先,您需要一个表格。 You can read this article to understand how to do this and how get your form values with form tutorial 您可以阅读本文以了解如何执行此操作以及如何通过表单教程获取表单值

After you'll need to put those values in a database. 之后,您需要将这些值放入数据库中。 To do that i recommand you PDO 为此,我建议您PDO

But you probably should practice withsome tutorial before did you try to do this one ? 但是您可能应该先尝试一些教程,然后再尝试进行教程?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM