₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,489 members, 8,422,301 topics. Date: Monday, 08 June 2026 at 04:50 AM

Toggle theme

Php Form To Email Script - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmasters Php Form To Email Script (1381 Views)

1 Reply

Php Form To Email Script by jozzy(op): 11:48am On Feb 06, 2007
Can any one help me out how can i get php form to email script, and put on, on how to put on the code
Re: Php Form To Email Script by uspry1(f): 12:25am On Feb 07, 2007
Create PHP-based email form script

First, PHP must be configured correctly in the php.ini file with the details of how your system sends email. (change your smtp outgoing mail, and email address) Open your PHP.ini in a text editor then find the section headed [mail function]. The configuration for Windows should look like this:


[mail function]
; For Win32 only.
SMTP = smtp.yourdomain.com

; For Win32 only.
sendmail_form = yourusername@yourdomain.com


or the configuration for LINUX should like this:

[mail function]
; For Win32 only.
SMTP =

; For Win32 only.
sendmail_form =

; For Unix only.
sendmail_path = /usr/lib/sendmail -t


Second, save your PHP.ini and close the window.

Third, copy the code that creates HTML form script to be pasted in a text editor or HTML editor as follow:


<html>
<head>
<title>Feedback Form</title>
</head>
<body>
<form action="feedback.php" method="POST">
Name: <input type="text" name="username" size="30" />
<br><br>
Email: <inpurt type="text" name="useraddr" size="30" />
<br> <br>
Message: <textarea name="comments" cols="30" rows="5"></textarea>

<input type="submit" value="Send Form">
</form>
</body>
</html>


Fourth, save as "feedback.html".

Fifth, copy the code that creates PHP script in a text editor, PHP editor or Dreamweaver with PHP extension plugs-in as follow:

<?php
    #recipient's email address
    $to = "yourusername@yourdomain.com";

   #subject of the message
   $re = "Website Feedback";

   #message from the feedback form
   $msg = $comments;

   #send the email now,
   mail($to,$re,$msg);
?>

<html><head><title>Message Received</title></head>
<body>
<h3>Thanks for your comments</h3>

Message received from <?php echo($username); ?><br>
Reply to <?php echo ($useraddr); ?>
</body></html>


Finally save as "feedback.php", then upload two files "feedback.html" and "feedback.php" to your web hosting server in the html directory folder (where you place all html files). That's it! Your feedback.html runs on the web page ready! You can test to submit your feedback form yourself. You should receive the form result directly to your email address.
Re: Php Form To Email Script by jozzy(op): 3:08am On Feb 07, 2007
Thanks a lot i will try that
1 Reply

Connecting Your Form To Interswitch WebpayGet Your Form To Email Script With Auto-responder Facility.Code For Send Form Content To Email Using Php234

Attract A Million Unique Visitors To Your Site Within 3 Months FreeJust Built A Personal Website: Plz Review And CommentsBasic Internet Terms Every User Should Know And Their Meaning