how do I use my websites theme or template for my PHP contact form?
I have a php contact form script, but its just a white page with the input fields on it, pretty boring..
All I want to do is use my websites template or theme of my site for the form as well. And I also want to put it in the text area if possible.
Anyone know how to do that please?
Thanks.
pr0gr4mm3r posted this at 20:31 — 24th February 2008.
He has: 1,502 posts
Joined: Sep 2006
It depends on what script you are using for your contact form and what the rest of your site is using.
You will most-likely have to edit the files of your contact form to match the rest of your site.
DSSR posted this at 22:00 — 24th February 2008.
They have: 166 posts
Joined: Mar 2006
I want to put this php form, into my contact page so it has my header, buttons exactly looking like my site does, but with the form in the text area.
My contact page is xhtml.
Can I link to this form somehow and make it show up in an xhtml or html page I choose? So I can have the form showup exactly where I want it in my page? So i dont have to theme it with css, because my pages are already using css?
JeevesBond posted this at 23:40 — 24th February 2008.
He has: 3,956 posts
Joined: Jun 2002
Your form should be in a PHP file, you can edit that file to contain the same tags (heading area, sidebars and what not) as the rest of the pages on the site.
Hmmm, possibly, but it will have to be a file with the name ending:
.php
, it's possible that Apache has been setup on your server to also treat.html
files as PHP, although this configuration is uncommon.Try making a copy of your chosen xhtml/html page to
test.php
, then add the following code:<?php
include formfile.php;
?>
You'll need to change
formfile.php
to the name of the file your form is in. Hope this makes sense.a Padded Cell our articles site!
DSSR posted this at 01:06 — 25th February 2008.
They have: 166 posts
Joined: Mar 2006
Thanks Jeeves
I tried it, but wehre do I put the code? header, or place I want the form to appear?
http://twtcouriers.only-the-truth.com/twtcontact.php
Got errors.
Warning: main(contactphp): failed to open stream: No such file or directory in D:\Inetpub\vhosts\only-the-truth.com\subdomains\twtcouriers\httpdocs\twtcontact.php on line 28
Warning: main(): Failed opening 'contactphp' for inclusion (include_path='.;./includes;./pear') in D:\Inetpub\vhosts\only-the-truth.com\subdomains\twtcouriers\httpdocs\twtcontact.php on line 28
I couldnt name it contact.php because I already have a file contact.php with the form in it. So I named it twtcontact.php instead. it says its not there, but it mustbe otherwise the page wouldnt have opened right?
I also changed the formfile.php to contact.php.
You know where im going wrong bud?
JeevesBond posted this at 04:10 — 25th February 2008.
He has: 3,956 posts
Joined: Jun 2002
Ooops, think I got this wrong. Try:
<?php
include "contact.php";
?>
That will work, but you only really need one file for a contact page. It would probably be better to just copy the styling, headings, sidebars etc. into your contact.php
Where you want the form to appear. It will literally pull the whole contents of contact.php into twtcontact.php.
It's saying contact.php doesn't exist, but it's really having problems because I forgot the inch marks around the
contact.php
a Padded Cell our articles site!
DSSR posted this at 09:53 — 25th February 2008.
They have: 166 posts
Joined: Mar 2006
Oh legend, it works
Yeah, I dont know how to do the styling, I didnt do it, sitegrinder did it. Put it all in a common.css file, and I tried to link the contact.php to that file, but all it gave me was the background.
But ill leave it this way, works great
Thanks Jeeves ..
JeevesBond posted this at 20:03 — 25th February 2008.
He has: 3,956 posts
Joined: Jun 2002
My pleasure!
If it works and you're happy, fine. Also if some third party thingy created your form for you, it's probably better to just include it, then if you create a new form you just have to overwrite the existing file.
a Padded Cell our articles site!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.