• i’m indonesia and not well in english. i’ve many times googling and didn’t found any ways. i’ve develop a plugin, simple plugin, to let people add their data without registering.

    for example, i’m selling a tshirt. and i make it pre-order list. so people that want to buy they only need put their name and contact into my site, which will submit into my wp database without register or login.

    and what i’m asking, is there any way to let form in frontend to send data and insert into database without login or register as a user? thanks and sorry for my bad english.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes there is. You could create a page template to do this. When you add a page using this template anyone can view and use this page.

    Be very careful though, allowing random users to add to your database is a way to get hacked. The form should include a nonce to ensure any requests actually come from this form. All input must be validated and sanitized.

    Thread Starter Rahendra Putra K™

    (@rahendz)

    right. i use a page template and using shortcode to run my plugin form. could you tell me how to do include nonce into my form, validated and sanitize. or refer a solving thread that more or less has a same problem like me.

    i’m still confused about class or function want to be used to triggered the form to validate and push data into db.

    Moderator bcworkz

    (@bcworkz)

    To put data in or get it out, or do any other DB operations, use the $wpdb object. It has various methods to do whatever you need with the DB.

    To place a nonce use wp_create_nonce() and to verify it use wp_verify_nonce(). The value is typically stored in a hidden form field. Be aware that a WP nonce is not a true nonce, it can be used any number of times within a certain time period (24 hours I believe). It does confirm the form is valid, but does not limit the form’s use to one time only.

    Validating and sanitizing data is a broad topic and depends on the nature of you data. You can start by reviewing Data Validation.

    Thread Starter Rahendra Putra K™

    (@rahendz)

    @bcworkz – i’ve tried those and did well. thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘could fontend form send post data into database’ is closed to new replies.