TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-08-2007, 01:41 AM   #1 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Simple & Expansive Contact Form

For our first script giveaway I have coded a simple contact form. This script is easy to expand onto, all you have to do to add more fields is follow the simple rules:
  • Add an input box, select area, text area - whichever field type you desire to the form.
  • Give its name a prefix of txt and then follow it by the name of the actual label you wish to associate with its value.

For instance:

Code:
<p>
	<label for="txtName">Name:</label>
	<input type="text" name="txtName" id="txtName" />
</p>
This would show up in the e-mail as:

Quote:
Name: myName
As you can see in the above example, the word name appears 3 times. The label node, and subsequently the ID attributes, are optional. However, the name attribute on the <input> node is required for the contact form to work correctly.

If you open up the file contained within the /lib/ directory entitled TalkPHPContact.class.php then you can edit the 2 important defines. These are:

PHP Code:
const RECEPIENT    'script@talkphp.com';
const 
TITLE        'TalkPHP - Contact'
  • RECEPIENT: The person who the e-mail will be sent to.
  • TITLE: The title of the e-mail

By default the form supports the following:
  • Name
  • Email
  • Inquiry

Any questions about the script, don't hesitate to respond within this thread. Enjoy it!
Attached Files
File Type: zip TalkPHP.Contact.zip (1.2 KB, 137 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 09-11-2007, 10:55 AM   #2 (permalink)
The Contributor
 
Craddock's Avatar
 
Join Date: Sep 2007
Location: Leicesterrrr
Posts: 38
Thanks: 0
Craddock is on a distinguished road
Default

I'm using it, Thanks :)
Send a message via MSN to Craddock
Craddock is offline  
Reply With Quote
Old 09-11-2007, 02:54 PM   #3 (permalink)
daz
The Contributor
Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 31
Thanks: 0
daz is on a distinguished road
Default

This is a great script Wildhoney but is there any need to use classes and such for a small script like this?
daz is offline  
Reply With Quote
Old 09-11-2007, 03:00 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

None at all except my feeling that people may wish to expand onto it and thus I've started them off in the right direction!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 09-11-2007, 03:04 PM   #5 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Some people have asked for a PHP4 version of the contact form. Here it is! :)
Attached Files
File Type: zip TalkPHP.Contact.PHP4.zip (1.2 KB, 100 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 05:19 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design