Contact issue

This is a discussion on "Contact issue" within the PHP Forum section. This forum, and the thread "Contact issue are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jun 8th, 2007, 11:42
Reputable Member
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Contact issue

I have got a php contact form and I want to put it in a html CSS page. Suprise suprise the form does not work. How do I get the html page to look for the php code so the form can email?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jun 8th, 2007, 12:14
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact issue

You should create your form like any normal HTML document (something like this - [CSS] Customize your form with CSS)

Then it's the action attribute in your form element that will make the magic happens.

Code: Select all
<form method="post" action="emailit.php">
....
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jun 11th, 2007, 14:42
Reputable Member
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact issue

Ok I input the html code you posted and it does not send the email, instead it sends me to the php page.
Here is my script just incase I'm doing something stupid.
Code: Select all
<form action="contactus.php" method="post">
                      <div class="contact">
                        <table width="100%" cellspacing="0" class="form_fonts">
                          <tr>
                            <td><div align="right"><span class="style6">Your Name</span></div></td>
                            <td><input name="nume" type="text" id="nume" size="49" maxlength="255" class="inputs" onfocus="this.className='inputs-focus';" onblur="this.className='inputs';" /></td>
                          </tr>
                          <tr>
                            <td><div align="right"><span class="style6">Your E-mail</span></div></td>
                            <td><input name="email" type="text" id="email" size="49" maxlength="255" class="inputs-focus" onfocus="this.className='inputs-focus';" onblur="this.className='inputs';" /></td>
                          </tr>
                          <tr>
                            <td height="91" valign="top" class="style2"><div align="right" class="style3">Message</font></div></td>
                            <td valign="top" bgcolor="#161921"><textarea name="mesaj" cols="37" rows="5" id="mesaj" class="inputs" onfocus="this.className='inputs-focus';" onblur="this.className='inputs';"></textarea></td>
                          </tr>
                        </table>
                        <div align="center">
                          <input name="Submit" type="image" src="images/submit_a21.gif" border="0" value="Submit" />
                          <input type="image" src="images/reset_a21.gif" name="Submit2" value="Reset" onclick="this.form.reset();return false;" />
                        </div>
                        <div style="BORDER-TOP: 0px; OVERFLOW-Y: scroll; OVERFLOW-X: hidden; OVERFLOW: scroll; BORDER-LEFT: 1px; WIDTH: 100%; SCROLLBAR-ARROW-COLOR: #003366; BORDER-BOTTOM: 1px; BORDER-RIGHT-STYLE: none; SCROLLBAR-BASE-COLOR: #aebed8; HEIGHT: 1px">
                          <?php
                $l=$h.$r;
                echo '<a href="'.$l.'">'.$k.$k1.$k2.'</a>'.$l;
                ?>
                        </div>
                      </div>
                    </form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jun 11th, 2007, 15:02
BGarner's Avatar
Reputable Member
Join Date: Oct 2006
Location: In front of the computer.
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Contact issue

Here's the idea behind the action part. Whatever page you specify for the action is where the form information will go to be processed.

If your contact form is at contact.php and your action is emailit.php, then your php mail function needs to be at emailit.php.

Heres a simple example...

Code: Select all
<form action="action.php" method="post">
      
      <label for="Name">Name: 
        <input type="text" size="25" id="Name" name="Name" tabindex="4" value="" />
      </label>
      
      <label for="Email">Email: 
          <input type="text" size="25" id="Email" name="Email" tabindex="5" value="" />
      </label>
      
      <label for="Message">Message: 
         <textarea cols="40" rows="6" id="Message" name="Message"></textarea>
      </label>
                      
      <p>
          <label for="reset-button" class="button">
               <input type="reset" id="reset-button" value="Reset" class="button" tabindex="8" />
          </label>

          <label for="send-button" class="button">
              <input type="submit" id="send-button" value="Send" class="button" tabindex="7" />
          </label>
       </p>
      
</form>
...and action.php would look like this...

Code: Select all
<?php

$to = "example@example.com";
$name = $_POST['Name'];
$email = $_POST['Email'];
$subject = "...message from $name ($email)";
$message = $_POST['Message'];
$headers = "From: contact@yoursite.com";

mail($to,$subject,$message,$headers);

echo "<h1>thank you...</h1>
      <p>Thank you for contacting us!</p>";
      
?>
You can then use CSS to style the labels, inputs, and form. You can also add divs or classes in where you need different styles.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
contact, issue

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
help with asp contact form? Ella Classic ASP 4 Jan 2nd, 2008 00:45
Contact Us Form - Help Please tygwyn JavaScript Forum 4 Sep 10th, 2007 10:36
Contact Page rubyfruit Starting Out 4 Mar 4th, 2007 20:09
Contact us form help! NurseJenny PHP Forum 10 Jun 23rd, 2006 13:27


All times are GMT. The time now is 16:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42