Submit php form to database

Source: Internet
Author: User
Tags php form php form to database
Welcome to the Linux community forum and interact with 2 million technical staff. 1. Configure MySQL1 in php, and set php_mysql.dll in the php installation directory and libmysql In the MySQL installation directory. copy the dll file to c: windowssystem32; 2. Configure php. iniextensionphp_gd2.dllextensionphp_mbstring.dllextens

Welcome to the Linux community forum and interact with 2 million technical staff> 1. Configure MySQL in php 1. Set php_mysql.dll in the php installation directory and libmysql In the MySQL installation directory. copy the dll file to c:/windows/system32; 2. Configure php. ini extension = php_gd2.dll extension = php_mbstring.dll extens

Welcome to the Linux community forum and interact with 2 million technicians>

I. Configure MySQL in php

1. Copy the php_mysql.dll and libmysql. dll files in the php installation directory to c:/windows/system32;

2. Configure php. ini

Extension = php_gd2.dll

Extension = php_mbstring.dll

Extension = php_mysql.dll

Extension = php_mysqli.dll

Put the four above. Remove the front of the dll.

II. Implementation of php form submission to database

1. login. php page

  

  

  

2. add. php page

  

Include ("conn. php ");

?>

  

If (isset ($ _ POST ["submit"])

{

$ SQL = "insert into users (username, email) values ('$ _ POST [username]', '$ _ POST [email]')";

Mysqli_query ($ conn, $ SQL );

Echo "added successfully ";

}

?>

3. conn. php page

  

$ Conn = new mysqli ("localhost", "root", "159357 ");

$ Conn-> select_db ("db_test ");

// Mysql_query ("set name 'gb2312 '");

$ Conn-> set_charset ("utf8 ");

?>

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.