Please help a big brother and sister to cry.
Untitled Document
Echo" ";
Include "check_admin.php ";
Echo "add question bank
\ N ";
If (! $ _ POST ["type"])
{
?>
}
Else if (! $ _ POST ["content"])
{
?>
}
Else
{
Include "config. php ";
$ Type = $ _ POST ["type"];
$ Content = $ _ POST ["content"];
$ Answer = $ _ POST ["answer"];
If ($ type! = 1)
{
$ SQL = "INSERT INTO $ db_examsystem_question (content, type, answer) VALUES ('$ conten', '$ type',' $ answer ')";
$ Result = mysql_query ($ SQL, $ my_con) or die (mysql_error ());
If ($ result)
{
Echo "successfully added question bank ";
Echo "Click here to return ";
}
Else echo "an error occurred while adding a question bank ";
}
Else
{
$ Check = $ _ POST ["check"];
$ SQL = "INSERT INTO $ db_examsystem_question (content, type) VALUES ('$ content',' $ type ')";
$ Result = mysql_query ($ SQL, $ my_con) or die (mysql_error ());
$ Question_id = mysql_insert_id ();
$ Sql2 = "insert into $ db_examsystem_answer (content, question, answer) VALUES ";
For ($ I = 0; $ I <4; $ I ++)
{
$ Sql2 = $ sql2 ."(";
$ Sql2 = $ sql2. "'". $ answer [$ I]. "',";
$ Sql2 = $ sql2. $ question_id ."'";
If ($ check = $ I) $ sql2 = $ sql2. "1 )";
Else $ sql2 = $ sql2. "0 )";
If ($ I <3) $ sql2 = $ sql2 ."'";
}
$ Result2 = mysql_query ($ sql2, $ my_con) or die (mysql_error ());
If ($ result and $ result2)
{
Echo "successfully added question bank ";
Echo "returns from a single machine ";
}
Else echo "an error occurred while adding a question bank ";
}
}
Echo" ";
?>
This is an online Q & A system assigned by the teacher. I wrote this part to add the question Library. However, after I click the last confirmation button, it does not jump to the database statement. he always returns to the previous step, that is, I cannot. I have been bothering you for a week to save the written question content to the database. thank you!
Reply to discussion (solution)
123123