Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

php dan mysql - Kirim kotak centang, tombol radio, dan hasil menu drop-down dari pengguna ke database mysql dan simpan di sana

bisa coba kode ini

<?php
    if(!empty($_POST) && isset($_POST["submit-btn"])){
        $gender = isset($_POST["student_gender"]) ? $_POST["student_gender"] : "";
        $student_session_one_preference = isset($_POST["student_session_one_preference"]) ? $_POST["student_session_one_preference"] : "";
        // do the rest of the elements

        echo $student_session_one_preference;
    }
?>


<form method="POSt">
<input type="radio" name="student_gender" value="Male">Male<br>
<input type="radio" name="student_gender" value="Female">Female<br>


<select name="student_session_one_preference">
                    <option value="Session 1">Session 1: June 30 - July 21</option>
                    <option value="Session 2">Session 2: July 28 - August 18</option>
                </select> <br/>
                Preference 2:
                <select name="student_session_two_preference">
                    <option value="Session 1">Session 1: June 30 - July 21</option>
                    <option value="Session 2">Session 2: July 28 - August 18</option>
                </select>


<input type="checkbox" name="waldron_scholarship" value="Waldron Scholarship">Waldron Scholarship<br/>
                    <input type="checkbox" name="jesse_van_anterp_huyck_scholarship" value="Jesse Van Anterp Huyck Scholarship">Jesse Van Anterp Huyck Scholarship<br/>
                    <input type="checkbox" name="edward_raney_scholarship" value="Edward Raney Scholarship">Edward Raney Scholarship<br/>


<select name="school_type">
                    <option value="Public">Public</option>
                    <option value="Private">Private Parochial</option>
                    <option value="Other">Other</option>
                </select>


<input type="radio" name="waiver" value="">I waive any right of access that I may have to information submitted by my referee<br>
                    <input type="radio" name="waiver" value="">I do not waive any right of access that I may have to information submitted by my referee<br>


<input type="checkbox" name="student_statement_consent_check_box" value="Agree">By checking this box, the student acknowledges <br/> that they have read the statement <br/> of consent and agrees with it.<br>


<input type="checkbox" name="guardian_statement_consent_check_box" value="Agree">By checking this box, the guardian acknowledges <br/> that they have read the statement <br/> of consent and agrees with it.<br>

<input type="submit" value="Submit" name="submit-btn">

</form>

kode ini mengasumsikan bahwa formulir dikirimkan ke halaman yang sama.

Semoga ini bisa membantu Anda.




  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Bagaimana cara menggabungkan tiga kueri MySQL menjadi satu?

  2. Kesalahan saat menggunakan array_push -- Argumen pertama harus berupa array

  3. Sekuel kembali bergabung dengan tabel dalam kueri

  4. Unggah file Jquery ke database di base64

  5. Pilih pelanggan tertentu di MYSQL?