MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

WordPress Plug in Making Tutorial: Saving Data to Database

Source: Shangpin China | Type: website encyclopedia | Time: May 6, 2012
Beijing website construction Shangpin China (www.sino web. net): This article explains how to save the data in the database and display it on the page. The content in the input box will not disappear when the form is submitted. To realize this function, we need to use the WordPress function. Next, we will explain the specific implementation method, and paste the code first. According to the previous plug-in example, you can directly modify it.

//Display a submenu in WordPress background comments

add_action('admin_menu', 'my_plugin_menu2');

function my_plugin_menu2() {

Add_comments_page ('data saving ',' data saving ',' read ',' my unique identifier ',' my_plugin_function2 ');

}

function my_plugin_function2()

{

if($_POST['test_hidden'] == 'y')

{

update_option('test_input_c',$_POST['test_input']);

//Update the database you added

?>
 
Save successfully!

}

?>

Add Data

Add data here.

 
 






 

 

 






 




 

}

//The information stored in the database is displayed through get_option().

//The above information is stored in the wp_options table in the database.

?>

The above short code implements the function of saving and displaying data. Through this function, we can extend to other methods or functions. For example, some good themes have theme settings, and some of the display and storage can be achieved using the above methods, so you can try more.

Well, that's all for this article. If you don't understand or have good suggestions, please ask questions and guide.
This article was published by Beijing Website Construction Company Shangpin China //ihucc.com/
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]