Home   Blog   About

How to embed the contact form in your web pages

This page shows you how to embed the contact form in a web page. Different methods are shown; you can decide which is the best 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.

Here are some sample contact forms embedded using iframe.

  • Simple Contact form
  • Contact form with captcha
  • Contact form with file upload and conditional recipients

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>

  • Digg
  • del.icio.us
  • Netscape
  • Reddit
  • StumbleUpon
  • Technorati
  • YahooMyWeb


Related pages

  © 2008-2010 html-form-guide.com .