Nothing is sent to the database and shows an empty line:
Test English Test №: 1
Choose a teacher's name: S.lov
Student Name:
Student Name:

  1. He was an HONEST man.
    A) liar B) good C) bad D) truthful E) wonderful
  2. The climate of Great Britain is MILD.
    A) Difficult B) strong C) severely D) bad E) good
<?php require_once 'connect.php'; ?> 
 <form method="post" action=" handler.php"> < <input align="center" name="tip_obiect" value="English">Тест на англиском <input name="varianta" value="1">Тест №:1</label> <br> <label for="Nume_Prof">Выбери имя учителя:</label> <SELECT> <OPTION value=""></OPTION> <OPTION name="Nume_Prof" value="C.лов">S.лов</OPTION> </SELECT><br> Имя студента: <input type="text" name="Nume" size="20"><br> Фамилия Студента: <input type="text" name="Prenume" size="18"><br><br> 1. He was an HONEST man. <br> <INPUT TYPE="radio" NAME="rad1" Value="true" CHECKED >A) liar </INPUT> <INPUT TYPE="radio" NAME="rad1" Value="false">B) good </INPUT> <INPUT TYPE="radio" NAME="rad1" Value="false">C) bad </INPUT> <INPUT TYPE="radio" NAME="rad1" Value="false">D) truthful </INPUT> <INPUT TYPE="radio" NAME="rad1" Value="false">E) wonderful</INPUT> <br> <br>2. The climate of Great Britain is MILD.<br> <INPUT TYPE="radio" NAME="rad2" Value="true" CHECKED > A) difficult</INPUT> <INPUT TYPE="radio" NAME="rad2" Value="false" >B) strong</INPUT> <INPUT TYPE="radio" NAME="rad2" Value="false" >C) severe</INPUT> <INPUT TYPE="radio" NAME="rad2" Value="false" >D) bad</INPUT> <INPUT TYPE="radio" NAME="rad2" Value="false" >E) good</INPUT> </form> 

//connect.php

 <?php error_reporting(0); $db_host = 'localhost'; $db_user = 'root'; $db_password = ''; $db_name = 'testare'; $link = mysqli_connect($db_host, $db_user, $db_password, $db_name); 

if (! $ link) {die (''. mysqli_connect_errno (). '-' .mysqli_connect_error (). '

'); }

  echo "<p>Вы подключились к MySQL!</p>"; 

//handler.php

 <?php require_once 'connect.php'; ?> 
 <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Основы PHP и MySQL</title> <style> * { font-family:Calibri } </style> </head> <body> <?php // Получить данные из суперглобального массива $_POST и обработать их $Tip_obiect = isset($_POST['Tip_obiect']) ? rim(mysqli_real_escape_string($link, $_POST['Tip_obiect'])) : ''; if (!empty($Tip_obiect)) { $link->query("INSERT INTO Obiect(Tip_obiect) VALUES ('{$Tip_obiect}')"); $nume = isset($_POST['nume']) ? rim(mysqli_real_escape_string($link, $_POST['nume'])) : ''; 

if (! empty ($ nume)) {$ link-> query ("INSERT INTO Student (nume) VALUES ('{$ nume}')");

 $prenume = isset($_POST['prenume']) ? trim(mysqli_real_escape_string($link, $_POST['prenume'])) : ''; 

if (! empty ($ prenume)) {$ link-> query ("INSERT INTO Student (prenume) VALUES ('{$ prenume}')");

 $varianta = isset($_POST['varianta']) ? trim(mysqli_real_escape_string($link, $_POST['varianta'])) : ''; 

if (! empty ($ varianta)) {$ link-> query ("INSERT INTO test (varianta) VALUES ('{$ varianta}')");

 $Nume_Prof = isset($_POST['Nume_Prof']) ? trim(mysqli_real_escape_string($link, $_POST['Nume_Prof'])) : ''; 

if (! empty ($ Nume_Prof)) {$ link-> query ("INSERT INTO obiect (Nume_Prof) VALUES ('{$ Nume_Prof}')");

  // Проверяем прошла ли операция (свойство affected_rows возвращает число строк, // затронутых предыдущей операцией MySQL (в нашем случае 1) if ($link->affected_rows == 1) echo '<h1>даные </h1>'; else echo '<p>Что-то пошло не так при попытке записи в базу данных</p>'; }}}}} ?> 
  • What does "showing empty line" mean? Of course, I understand that you are new to web programming and all that, but the code that you dropped was actually unreadable: so that a person could help you, he would have to format this horror humanly, and then delve into what he does. I quickly ran over my eyes and noticed so far only that your name and value attributes do something on the <h3> element. In this case, for the same attribute name value starts with a small letter, and in PHP you accept a field that starts with a capital letter - these are two different variables. - neluzhin

2 answers 2

The name in is put.
Field names (name, value) write in lower case.
handler.php - errors. There are no rim functions at all, replace with trim
Below is a hidden field to send 'tip_obiect'
Try not to use br - control the type of the element (put it display: block; for example)

 <form method="post" action="handler.php"> <h3 align="center">Тест на англиском </h3> <span>Тест №:1</span><br> <span>Выбери имя учителя:</span> <select name="nume_prof"> <OPTION value=""></OPTION> <OPTION value="S.лов">S.лов</OPTION> </select><br> <label for="nume">Имя студента:</label> <input type="text" name="nume" size="20"><br> <label for="prenume">Фамилия Студента:</label> <input type="text" name="prenume" size="18"><br><br> <span>1. He was an HONEST man.</span> <br> <input type="radio" name="rad1" id="liar" value="true" checked /> <label for="liar">A) liar</label> <input type="radio" name="rad1" id="goods" value="false"/> <label for="goods">B) good</label> <input type="radio" name="rad1" id="bads" value="false"/> <label for="bads">C) bad</label> <input type="radio" name="rad1" id="truthful" value="false"/> <label for="truthful">D) truthful</label> <input type="radio" name="rad1" id="wonderful" value="false"/> <label for="wonderful">E) wonderful</label><br> <br>2. The climate of Great Britain is MILD.<br> <input type="radio" name="rad2" id="difficult" value="true" checked /> <label for="difficult">A) difficult</label> <input type="radio" name="rad2" id="strong" value="false" /> <label for="strong">B) strong</label> <input type="radio" name="rad2" id="severe" value="false" /> <label for="severe">C) severe</label> <input type="radio" name="rad2" id="bad" value="false" /> <label for="bad">D) bad</label> <input type="radio" name="rad2" id="good" value="false" /> <label for="good">E) good</label> <input type="hidden" name="tip_obiect" value="English"/> </form> 

//handler.php

 $tip_obiect = trim(mysqli_real_escape_string($_POST['tip_obiect'])); if (!empty($tip_obiect)) $link->query("INSERT INTO Obiect(Tip_obiect) VALUES $tip_obiect"); $nume = trim(mysqli_real_escape_string($_POST['nume'])); if (!empty($nume)) $link->query("INSERT INTO Student(nume) VALUES $nume"); $prenume = trim(mysqli_real_escape_string($_POST['prenume'])); if (!empty($prenume)) $link->query("INSERT INTO Student(prenume) VALUES $prenume"); $varianta = trim(mysqli_real_escape_string($_POST['varianta'])); if (!empty($varianta)) $link->query("INSERT INTO test(varianta) VALUES $varianta"); $nume_prof = trim(mysqli_real_escape_string($_POST['nume_prof'])); if (!empty($nume_prof)) $link->query("INSERT INTO obiect(Nume_Prof) VALUES $nume_prof"); if ($link->affected_rows == 1) echo '<h1>даные </h1>'; else echo '<p>Что-то пошло не так при попытке записи вашего email в базу данных</p>'; 

    GET method is replaced by POST in the form

     <form method="GET" на <form method="POST"