Home>
We are creating something that registers the input contents in the database with PHP.
The error message is not displayed and it is "Registered".
When I look at the database, the updated contents are not reflected.
No error message is displayed, but the input is not registered in the database.
Applicable source codedatabase1.php
<html>
<head>
<meta http-equiv = "Content-Type" content = "text/html;charset = utf-8" />
<title>Assign assignment</title>
</head>
<body>
New assignment registration
<form action = "database2.php" method = "POST">
<p>No.</p>
<input type = "text" name = "id" value = "" size = "50">
<br>
<table border = '1'>
<tr>
<th width = "100" nowrap>FY</th>
<th width = "100" nowrap>Class</th>
<th width = "100" nowrap>times</th>
<th width = "100" nowrap>Type</th>
<th width = "100" nowrap>Genre</th>
<th width = "100" nowrap>Difficulty</th>
</tr>
<tr>
<th width = "100" nowrap>
<select name = "year">
<option value = "2020">2020</option>
<option value = "2019">2019</option>
<option value = "2018">2018</option>
</select>
<th width = "100" nowrap>
<select name = "class">
<option value = "1">1</option>
<option value = "2">2</option>
<option value = "3">3</option>
<option value = "4">4</option>
<option value = "5">5</option>
<option value = "6">6</option>
<option value = "7">7</option>
<option value = "8">8</option>
<option value = "9">9</option>
</select>
<th width = "100" nowrap><select name = "number">
<option value = "1st">1st</option>
<option value = "2nd-3">2nd-3</option>
<option value = "4-5">4-5</option>
<option value = "6-7-7">6-7-7</option>
<option value = "8-9">8-9</option>
<option value = "10th">10th</option>
<option value = "11th-12th">11th-12th</option>
<option value = "13-14">13-14</option>
<option value = "15th">15th</option>
</select>
<th width = "100" nowrap>
<select name = "genre">
<option value = "attendance assignment">attendance assignment</option>
<option value = "Basic assignment">Basic assignment</option>
<option value = "Development Issues">Development Issues</option>
</select>
<th width = "100" nowrap>
<select name = "mso">
<option value = "Word">Word</option>
<option value = "Excel">Excel</option>
<option value = "PowerPoint">PowerPoint</option>
<option value = "Other">Other</option>
</select>
<th width = "100" nowrap>
<select name = "level">
<option value = "easy">easy</option>
<option value = "Normal">Normal</option>
<option value = "difficult">difficult</option>
</select>
</tr>
</table>
<p>Title of the assignment<br>
<input type = "text" name = "practice" value = "" size = "50">
<p>Deadline<br>
<input type = "text" name = "time" value = "" size = "50">
<p>Included content (target)<br>
<input type = "text" name = "purpose" value = "" size = "200">
<p>Samples and other points to consider<br>
<input type = "text" name = "other" value = "" size = "200">
<p>Agenda file<br>
<input type = "text" name = "file" value = "" size = "50">
<p><input type = "submit" value = "Register with the above contents"></p>
</form>
</body>
</html>
database2.php
<html><head>
<meta http-equiv = "Content-Type" content = "text/html;charset = utf-8" />
<title>Assign assignment</title>
</head>
<body>
<? php
$con = mysqli_connect ('localhost', 'root', '2019minato');
if (! $con) {
exit ('Could not connect to database');
}
$result = mysqli_select_db ($con, 'test');
if (! $result) {
exit ('Database could not be selected');
}
$result = mysqli_query ($con, 'SET NAMES utf8');
if (! $result) {
exit ('The character code could not be specified.');
}
$id = filter_input (INPUT_GET, 'id');
$year = filter_input (INPUT_GET, 'year');
$class = filter_input (INPUT_GET, 'class');
$number = filter_input (INPUT_GET, 'number');
$mso = filter_input (INPUT_GET, 'mso');
$genre = filter_input (INPUT_GET, 'genre');
$level = filter_input (INPUT_GET, 'level');
$practice = filter_input (INPUT_GET, 'practice');
$time = filter_input (INPUT_GET, 'time');
$purpose = filter_input (INPUT_GET, 'purpose');
$other = filter_input (INPUT_GET, 'other');
$file = filter_input (INPUT_GET, 'file');
$result = mysqli_query ($con, "INSERT INTO bank (id, year, class, number, mso, genre, level, practice, time, purpose, other, file) VALUES ('$id', '$year', ' $class', '$number', '$mso', '$genre', '$level', '$practice', '$time', '$purpose', '$other', '$file') " );
if (! $result) {
exit ('Data could not be registered');
}
$con = mysqli_close ($con);
if (! $con) {
exit ('Could not close connection with database');
}
?>
<p>Registration is complete.<br />Back</p>
</body>
</html>
But where for theerror does not appear is wrong I have unfortunately not know.
Supplemental information (FW/tool version etc.)Please provide more detailed information here.
-
Answer # 1
Related articles
- unable to save input home contents in database with php
- in php, the gender field of the input form is not displayed on the confirmation form
- machine learning - i want to know the processing contents for the input data at the time of inference of the batch normalization
- [wordpress] html of the pager set in functionsphp is not reflected
- when i edit a js file in a php app that does not use fw and deploy it on heroku, it is not reflected
- create a bulletin board with php → user name is not reflected after login
- i want to get the csv value correctly using php
- php - transition page branch depending on the input contents of the form
- php - wordpress template file created is not reflected
- it will not be reflected unless you update the screen with ajax of php and jquery
- changes in phpini are not reflected in phpinfo
- i want to check the form input with php, display an error on the same page if it is not filled in, and move to another page only
- java - contents of defaultlistmodel are not reflected in jlist
- php - form values disappear when submitting values in input form
- php variable is not reflected in sql statement
- php - css is not reflected
- c++ - input operation of cin is not recognized correctly
- php - i would like to send the repeated contents in form
- php - html code of sidebar is not reflected when creating wordpress theme
- php - when i post the data entered in form, the contents disappear and i cannot receive it
Related questions
- php - i want to bind a database table, but i don't know how
- php - i am making a customer search system by studying, but i want to be able to connect to a database, but it does not work
- [laravel7] is it possible to use database records for the information in filesystemphp?
- php - target class [~] does not exist error
- php - class'database \ seeders \ seeder' not found error
- php - database i want to be able to select any sort
- db connection with vscode: php
- i get an error when trying to post data to a database with php
- [php] the post request is get
- php - display data only for currently logged in users
I tried various things using PDO instead of Mysql.