You are here: Home » All Posts » Contact Forms » How to embed the contact form in your web pages

How to embed the contact form in your web pages

in Contact Forms

This page shows you how to embed the contact form (see the free contact forms from HTML Form Guide) in a web page. Different methods are shown; you can decide which the best is, for you.

Using IFrame

Using Iframe is the easiest way to embed the form in your web page. Iframe lets you create a box on your web page whose contents are loaded from another URL. Here is a sample iframe code:

<iframe src='/contact/contactus.php' frameborder='0'
width='100%' height='600' allowtransparency='true'></iframe>

Update the src attribute with the URL path to your contact form. In order to avoid scrollbar from appearing, you can adjust the value of the ‘height’ attribute.

Including a header and footer in the contact form page

Another way to embed the contact form is to have a common header and footer across your website. You can include the header and footer in the contactform.php.

This method allows you to preserve the same look across the website.

Here is some sample code that illustrates this method.

Including the header:

<body>

<!--Note: The header is included here -->
<?php include('../includes/header.php'); ?>

<!-- The form start from here-->
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post'>
<fieldset >

Including the footer:

</script>

<!-- Note: Here we include the footer -->
<?php include('../includes/footer.php'); ?>

</body>
</html>
Be Sociable, Share!
Adam December 31, 2011 at 2:34 pm

I have attempted to add the form to the page: http://www.ACKnell.co.uk/contact.html however recieve some code errors. Can you help?

andi January 9, 2012 at 12:00 pm

how do I implement it into the html snipplet? very basic knowledge here.. help..!

aswathy January 11, 2012 at 7:05 am

please make these coding simple and clear

Joel January 11, 2012 at 11:38 pm

Thank you for sharing your forms.

Emma January 17, 2012 at 4:07 am

how do i create a contact us form like you guys have your leave a Comment form?

vilash January 24, 2012 at 5:14 am

just use the html form….give title as Contact us and create fields which u want to get the contact details like

.
.
.
.
that is it.

Hardy Estes February 7, 2012 at 6:31 pm

The form was really easy to embed but I am wondering how I can make new field required. I had duplicated the code from full name and pasted it again and then chenged the title but now I can leave one of them empy and it will go through. I ma new to this type of website building.

Alfonso Rabago March 2, 2012 at 10:20 pm

the anti spam bot question generator keeps asking all kinds of questions when you hit submit. is there somewhere i can limit these questions?

Mustafa March 19, 2012 at 10:32 pm

By these mail forms, is it possible to send a copy to ourselves ?

Comments on this entry are closed.

Previous post:

Next post: