Build a HTML Form From Scratch and Use in WordPress Post/Pages

You have many plugin to use form in your post/pages and they can do great job for you. but what about creating a simple form by own-self from scratch and use that in your posts?

so lets start with simple coding style and create a form with three field

this is a simple form to use in html page but not for WordPress. WordPress has its on ways.

to use this form in some post or page you need to create a page template or use shorcode to display form. page template are great way to go but in this case i am suggesting you to use wp shortcode.

So just move to your WordPress template directory and  open functions.php file

and place this short code there.

shortcode made our job so simple, now you can use [form ] to place everywhere in post/page. just put [form] in your posts and this will fetch code inside createform(); function.

so now put code in function

now create an new post and put [form] in your post , you must be able to see our created form there.

for next step to move we need to be able to submit this form. now again open up your functions.php file and put this code.

and you are done!