PHP form submission to database

Source: Internet
Author: User
Tags configuration php php form

First, PHP configuration MySQL

1, copy the PHP installation directory under the Php_mysql.dll and MySQL installation directory libmysql.dll files to C:/windows/system32;

2, Configuration PHP.ini

Extension=php_gd2.dll

Extension=php_mbstring.dll

Extension=php_mysql.dll
Extension=php_mysqli.dll

put the top four. dll above the front; Second, the implementation of the PHP form submission to the database process

1. login.php page

<span style= "FONT-SIZE:14PX;" >

2. add.php Page

<span style= "FONT-SIZE:14PX;" ><?phpinclude ("conn.php");? ><?phpif (Isset ($_post["Submit")) {    $sql = "INSERT into users (username, email) VALUES (' $_post[username] ', ' $ _post[email] "Mysqli_query ($conn, $sql); echo" Add Success ";}? ></span>

3. conn.php Page

<span style= "FONT-SIZE:14PX;" ><?php$conn = new Mysqli ("localhost", "root", "159357"), $conn->select_db ("Db_test");//mysql_query ("Set name ' gb2312 '); $conn->set_charset ("UTF8");? ></span>



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.