Php entry: save data to the database-PHP source code

Source: Internet
Author: User
Ec (2); & lt ;? Php & nbsp; include (& quot; incconnect. php & quot;); & nbsp; database connection & nbsp; include (& quot; incbase_function.php & quot;); & nbsp; // The get_value Function & nbsp; $ buy & nbsp; get_value (buy, post); & nbs script ec (2); script

Include ("inc/connect. php"); // database connection
Include ("inc/base_function.php"); // The get_value function is provided here.

$ Buy = get_value ('buy', post );
$ Month = get_value ('month', post );
$ Day = get_value ('day', post );
$ Time = get_value ('time', post );
$ Sum = get_value ('sum', post );
$ Name = get_value ('name', post );
$ Sex = get_value ('sex', post );
$ Mo = get_value ('mo', post );
$ Caption = get_value ('caption ', post );
$ Dtime = $ month. 'month'. $ day. 'day'. $ time ';
If (empty ($ name) | empty ($ sum) | empty ($ mo )){

Alert ('Sorry, please fill in your meal information carefully and we will contact you in time! ','');

} Else {

$ SQL = "Insert into gx_buy (buy, sum, name, sex, caption, mdt, mo) value ('$ buy',' $ Sum', '$ name ', '$ sex',' $ caption ',' $ dtime', '$ m ')";

Mysql_query ($ SQL) or die (mysql_error ());

Alert ('Congratulations, the order is successful. We will get in touch with you in the shortest time! ', $ _ SERVER ['HTTP _ referer']);

}

?>

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.