from http://codex.ww.wp.xz.cn/Function_Reference/wpdb_Class#INSERT_rows
<?php
// if using a custom function, you need this
global $wpdb
$lastn = 'Last Name';
$firstn = "First Name';
$wpdb->insert( 'clients', array( 'last_name' => $lastn, 'first_name' => $firstn ), array( '%s', '%d' ) )
?>
Ok, I can see that,
but how do I connect a form, which will be in one of the pages, where the customer will enter the information ??. I mean, that at what moment does the database know I am inserting from the form.
If you could, let me know more in detail..
Thank you very much for your first reply,
Ricardo
Hi Ricardo, it is quite unfortunate the Codex does not contain a real example of form posting, storing, and retrieving to redisplay the form!!
I recently posted an outline of such as you wish to do, here:
http://ww.wp.xz.cn/support/topic/user-application-editing-form-store-retrieval-from-db
I think the step you are missing is the form must post to some existing page URL, such as the page itself! Therefore the php code in the page must recognize the incoming post prior to starting to display anything. See if you can make sense of my example.
You also have to deal with the question of user identity. How do you know who is submitting the form? My example asks for a WordPress login to do this. Hence the data can be retrieved by that specific user in the future, to be updated!
Rich
http://ww.wp.xz.cn/extend/plugins/contact-form-7/
If you roll your own form, just be sure to properly sanitize any form posted data before it hits the db.