This is the code for the message section of the page. The problem is that the account is logged in, and then the message title and content are written, but the display fails after submission. I don’t know what went wrong. I hope you can teach me. Thank you. !
<?php
require("header.php");
if($_SESSION[username]=="")
{
echo "<script>alert('Please log in first');history.back();</script>";
exit;
}
if($act=="save")
{
if($title=="" || $content=="")
{
echo "<script>alert('Message title, content, cannot be empty');history.back();</script>";
exit;
}
Failure to display means that the program has entered, so it should be a problem with your SQL statement. You can put the sql statement into the database and run it. I feel that it may be a problem with the third column of your insert statement, which is inserted. The field name is userid, but the value that follows is username. Moreover, it is best to use camel case for naming. A good coding habit