Little Brother Beginner PHP. Ask questions about the submission of the form

Source: Internet
Author: User
Little Brother Beginner php ..... Ask the form for submission questions
$connec =mysql_connect ("localhost", "root", "Vertrigo") or Die ("Cannot connect to database server:". mysql_error ());
mysql_select_db ("Data", $connec) or Die ("Cannot select Database:". mysql_error ());
mysql_query ("Set names ' UTF8 '");
?>
if ($_post["id"] and $_post["action"]== "Del")
{
$sql = "Delete from class where Id=$_post[id]";
mysql_query ($sql, $connec);
Echo ("");
}
?>



There is always a mistake ....

How can I tell you how to determine the action of form submission?

What's more, it's not safe to do so. What can I do to be safe? Thank you.

------Solution--------------------
$_post[id] to $_get[id [change]
------Solution--------------------
What's wrong with the report?

Determining the type of user, whether logged in, is the easiest security check.
------Solution--------------------
The > Delete
The most common form submission is the submission Like, hyperlinks are submitted with get.
Remove and then use $_get to receive.
------Solution--------------------
To determine the basic parameters of the parameter, whether it is a numeric value, to determine whether the transmission is empty.

Generally there is no problem.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.