Irish SEO,  Marketing & Webmaster Discussion

 

Contact Form

This is a discussion on Contact Form within the Coding Help forums, part of the Webmaster Help category; Hey all. Im sure most of ye will be able to answer this in yer sleep so here goes, How ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2007, 10:51 PM
Coder
 
Join Date: Dec 2006
Location: Tipp
Posts: 58
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
bucks will become famous soon enough
Default Contact Form

Hey all.

Im sure most of ye will be able to answer this in yer sleep so here goes,

How do i go about getting information filled out on a contact form sent to my email address ? I had a look at formmail but i drew a blank...

Here is the code for the form that im using ;

PHP Code:
<form id="myform" class="cssform" action="">

<
p>
<
label for="user">Name:</label>
<
input type="text" id="user" value="" />
</
p>

<
p>
<
label for="phone">Phone:</label>
<
input type="text" id="phone" value="" />
</
p>


<
p>
<
label for="emailaddress">Email Address:</label>
<
input type="text" id="emailaddress" value="" />
</
p>

<
p>
<
label for="comments">Query:</label>
<
textarea id="comments" rows="5" cols="25"></textarea>
</
p>

<
div style="margin-left: 150px;">
<
input type="submit" value="Submit" /> <input type="reset" value="Reset" />
</
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
  #2 (permalink)  
Old 06-02-2007, 11:09 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,048
Nominated 5 Times in 3 Posts
Nominated TOTW/F/M Award(s): 1
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

can you run php code or asp code on your website hosting account?
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
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 (permalink)  
Old 06-02-2007, 11:18 PM
daviddoran's Avatar
Wannabe Geek
Recent Blog: iMSISS
 
Join Date: Aug 2006
Location: Meath, Ireland
Posts: 342
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
daviddoran will become famous soon enough
Default

Code:
<?php
if( isset($_POST['user']) && isset($_POST['emailaddress']) )
{
        $to = "youremail@yourdomain.com";
        $comments = (( isset($_POST['comments']) )?($_POST['comments']):(false));
        if( $comments!=False )
        {
                $subject = 'Query about: ' . substr($comments,0,10).'...';
                $name = (( isset($_POST['user']) )?($_POST['user']):('N/A'));
                $phone = (( isset($_POST['phone']) )?($_POST['phone']):('N/A'));
                $email = (( isset($_POST['emailaddress']) )?($_POST['emailaddress']):('N/A'));
                $message =
                'Name : '.$name."\n"
                .'Phone : '.$phone."\n"
                .'Email Address : '.$email."\n"."\n"
                .'Query : '.$comments."\n"."\n"
                .'From IP: '.(( isset($_SERVER['IP_ADDR']) )?($_SERVER['IP_ADDR']):('N/A'));
                $mail_result = @ mail( $to, $subject, $message );
                echo $message;
                if( $mail_result )
                {
                        echo 'Thank you for your query.';
                }
                else{ echo 'Unfortunately your query could not be received at this time, please try again later.'; }
        }
        else{ echo 'Sorry, you must enter a query.'; }
}
else
{
?>

<form id="myform" class="cssform" action="" method="post">
 <p>
    <label for="user">Name:</label>
    <input type="text" id="user" name="user" value="" />
 </p>

 <p>
    <label for="phone">Phone:</label>
    <input type="text" id="phone" name="phone" value="" />
 </p>

 <p>
    <label for="emailaddress">Email Address:</label>
    <input type="text" id="emailaddress" name="emailaddress" value="" />
 </p>

 <p>
    <label for="comments">Query:</label>
    <textarea id="comments" name="comments" rows="5" cols="25"></textarea>
 </p>

 <div style="margin-left: 150px;">
    <input type="submit" value="Submit" />
    <input type="reset" value="Reset" />
 </div>
</form>

<?php
}
?>
Is what you're looking for I believe.

And an example of the email your will receive:
Code:
Name : John Doe
Phone : 484839
Email Address : johndoe@gmail.com

Query : I want to know.

From IP: 221.243.24.13
You can change the error messages and the $to variable to your email address.
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 (permalink)  
Old 06-02-2007, 11:21 PM
Coder
 
Join Date: Dec 2006
Location: Tipp
Posts: 58
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
bucks will become famous soon enough
Default

php louie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 06-02-2007, 11:24 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,048
Nominated 5 Times in 3 Posts
Nominated TOTW/F/M Award(s): 1
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

dorran just gave you an example
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 06-02-2007, 11:37 PM
Coder
 
Join Date: Dec 2006
Location: Tipp
Posts: 58
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
bucks will become famous soon enough
Default

Cheers david, ill give that a go.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 07-02-2007, 07:45 AM
kae's Avatar
kae kae is offline
Byte Wrangler
Recent Blog: prompt
 
Join Date: Sep 2006
Location: monaghan
Posts: 54
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
kae will become famous soon enough
Default

first off - you need to use "name" as well as "id" in your inputs.

secondly - here's a drop-in replacement for formmail written in PHP: http://verens.com/files/formmail.tbz2
- you write your form as if you were going to send it to /cgi-bin/formmail.cgi, but instead, change the form "action" to point to the formmail.php in the archive. It also insists on a captcha, meaning that spambots won't use your mailer as a relay (sorry David - yours is wide open).
__________________
verens.com, webworks.ie
kfm.verens.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 07-02-2007, 07:57 PM
blacknight's Avatar
Web Slave
Recent Blog:
 
Join Date: Jan 2006
Location: Ireland
Posts: 6,578
blacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to behold
Send a message via ICQ to blacknight Send a message via AIM to blacknight Send a message via MSN to blacknight
Default

Kae
What kind of captcha does your version use? Is it GD based or text?

Michele
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 07-02-2007, 08:34 PM
kae's Avatar
kae kae is offline
Byte Wrangler
Recent Blog: prompt
 
Join Date: Sep 2006
Location: monaghan
Posts: 54
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
kae will become famous soon enough
Default

the example code uses GD (the captcha generator was not written by me). It might be interesting to make it more robust, though (I was only giving it as an example of a slightly more complete mailer) - you have something in mind?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 07-02-2007, 08:36 PM
blacknight's Avatar
Web Slave
Recent Blog:
 
Join Date: Jan 2006
Location: Ireland
Posts: 6,578
blacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to behold
Send a message via ICQ to blacknight Send a message via AIM to blacknight Send a message via MSN to blacknight
Default

The problem with image based captcha is that you are basically waving two fingers at anyone who is visually impaired, so a text based challenge is a saner option IMHO
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, form

Thread Tools
Display Modes

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
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Web Development Quote ButtermilkJack Marketplace Requests 5 24-01-2007 11:04 AM
Submit Email Form Gavin Coding Help 12 20-12-2006 10:57 AM


Sponsored links

Paid On Results


All times are GMT +1. The time now is 04:31 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0