Web Hosting Deals Holiday Logo Design Webcam Chat Website Header Templates Register domain Search Engine Optimisation Web Hosting
Go Back   Talk Mania Forum > Programming / Scripting / Coding

Programming / Scripting / Coding Got a question about : PHP / Perl / Java / JavaScript / CGI Scripts / JavaScript coding. Ask here! We'll get you the answers !

 Image
Buy Sell Downloads

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-13-2007, 02:44 PM
Junior Member
 
Join Date: Mar 2007
Posts: 21
enzo is on a distinguished road
PHP - send a form

please look at this page: . i have a form and i want to recive the info`s from there on an e-mail. i wanna now how can I do it and if there is an "already made" script in php. i`m lazy but is urent. thanks

__________________
www.enzo-design.ro // blog @: enzo-tm.blogspot.com ( only for romanian people )

Last edited by enzo; 03-13-2007 at 03:06 PM. Reason: wrong link for the page ...
Reply With Quote
  #2 (permalink)  
Old 03-14-2007, 04:58 PM
Base's Avatar
Senior Member
 
Join Date: Mar 2007
Location: North Yorkshire, UK
Posts: 121
Base is on a distinguished road
Send a message via MSN to Base Send a message via Skype™ to Base
Lazy...

To be honest there are thousands of scripts written in PHP for contact forms, as i have written a good number of them myself.

I will copy the code into this reply & include a zipped version incase your just too lazy to copy & paste the code.

You will need for this:

A brain
A vauge knowldge of PHP, but nothing above the very baisic level

What we are doing:

The code that i am going to show you is baisicly an entire contact script, it does not use SMTP servers (if you require an SMTP version PM me) it just uses the PHP mail function, this means it will most likely only work on linux.

But yeah!

To the code..

This is a very simple system using very very few lines of code.

There are no known bugs with this script BUT, this is not incredibly secure, but it works.

contact.html is as follows:

PHP Code:
<html>
<
head></head>
<
title>Contact Form</title>
<
body>
<
form method="post" action="sendmail.php">
  
Email: <input name="email" type="text" /><br />
  
Message:<br />
  <
textarea name="message" rows="15" cols="40">
  </
textarea><br />
  <
input type="submit" />
</
form>
</
body>
</
html
Ok so thats our contact page, where the user types in there email address & there message to you.

Now we get onto the "backend" as such of the script.

This is sendmail.php

PHP Code:
<?
  $email 
$_REQUEST['email'] ;
  
$message $_REQUEST['message'] ;

  
mail"yourname@example.com""Feedback Form Results",
    
$message"From: $email" );
  
header"Location: http://www.example.com/thankyou.html" );
?>

There are 3 things you need to change in this script.

"yourname@example.com" change to your email address

"Feedback Form Results" change to the subject of the email you want to recive.

Location: http://www.example.com/thankyou.html

Change to where you want the user to be sent once the script has emailed you.

Hope this hepls bro...

Base

(You can get the zipped copy here

Last edited by Base; 03-14-2007 at 05:01 PM. Reason: Adding ZIP file
Reply With Quote
  #3 (permalink)  
Old 03-14-2007, 07:02 PM
Junior Member
 
Join Date: Mar 2007
Posts: 21
enzo is on a distinguished road
thanks a lot. i will show you the results. and about the brain .. ... thik i have
__________________
www.enzo-design.ro // blog @: enzo-tm.blogspot.com ( only for romanian people )
Reply With Quote
  #4 (permalink)  
Old 03-14-2007, 07:23 PM
Base's Avatar
Senior Member
 
Join Date: Mar 2007
Location: North Yorkshire, UK
Posts: 121
Base is on a distinguished road
Send a message via MSN to Base Send a message via Skype™ to Base
lol gdgd

Glad to be of help to you

Any further questions just ask

Base
Reply With Quote
  #5 (permalink)  
Old 03-15-2007, 04:02 PM
Junior Member
 
Join Date: Mar 2007
Posts: 21
enzo is on a distinguished road
it works ..

so thanks again. to be honest this is my first time when i deal whit a code and notepad. it works just fine and i`ve made some tuning ... took me about 2 hours but it worths the effort.
i`ve included al the fields i`ve neded by your example but i`v removed the header tag so i must include that back. i will let you know when is finished.
thanks again
__________________
www.enzo-design.ro // blog @: enzo-tm.blogspot.com ( only for romanian people )
Reply With Quote
  #6 (permalink)  
Old 03-15-2007, 04:28 PM
Base's Avatar
Senior Member
 
Join Date: Mar 2007
Location: North Yorkshire, UK
Posts: 121
Base is on a distinguished road
Send a message via MSN to Base Send a message via Skype™ to Base
Ok mate, if you have any problems or need any fields adding to the script or anything, then just ask

Cheers

Base
__________________
http://www.pointserv.co.uk/gfx/deal_..._pointserv.png
PointServ.co.uk - One of the UK's cheapest webhosting companies.
Reply With Quote
  #7 (permalink)  
Old 03-15-2007, 04:53 PM
Junior Member
 
Join Date: Mar 2007
Posts: 21
enzo is on a distinguished road
so .. base can you help me whit this?

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/psa/home/vhosts/barum-automotive.ro/httpdocs/new/sendmail.php:9) in /usr/local/psa/home/vhosts/barum-automotive.ro/httpdocs/new/sendmail.php on line 29
Your message is being sent, pelase wait to automaticly be redirected.


wtf ?
brb .. in a hurry .. thanks
__________________
www.enzo-design.ro // blog @: enzo-tm.blogspot.com ( only for romanian people )
Reply With Quote
  #8 (permalink)  
Old 03-15-2007, 05:26 PM
Base's Avatar
Senior Member
 
Join Date: Mar 2007
Location: North Yorkshire, UK
Posts: 121
Base is on a distinguished road
Send a message via MSN to Base Send a message via Skype™ to Base
Ahh never thought of that..

Well, there are 2 alternatives..

You could use a HTML redirect

Code:
<META HTTP-EQUIV="Refresh"
      CONTENT="3; URL=thankyou.html">
Problems with this:
If the script hasen't propperly worked then it still redirects..

Or

You could just have a HTML redirect link

Code:
<a href="index.php">Email sent, please click here to continue</a>

Thinking about it, you could use an if statement but quite frankly i am too tired to write that down..

lol

Hope this helps.......

Base
__________________
http://www.pointserv.co.uk/gfx/deal_..._pointserv.png
PointServ.co.uk - One of the UK's cheapest webhosting companies.
Reply With Quote
  #9 (permalink)  
Old 03-16-2007, 08:57 AM
Junior Member
 
Join Date: Mar 2007
Posts: 21
enzo is on a distinguished road
thanks a lot .. resolved whit the redirect ...in 1 !!!! sec

__________________
www.enzo-design.ro // blog @: enzo-tm.blogspot.com ( only for romanian people )
Reply With Quote
Reply

Bookmarks

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


All times are GMT +2. The time now is 07:24 PM.


Fake ID

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC8
Forums Copyright © Talk-Mania.com