Current location: Hot Scripts Forums » Programming Languages » PHP » Help with contact form script...?


Help with contact form script...?

Reply
  #1 (permalink)  
Old 03-09-10, 04:21 AM
crb187 crb187 is offline
New Member
 
Join Date: Mar 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Help with contact form script...?

I am very new to this, an although i know basic html anything else it out of my comfort zone. I have just had this script quickly coded for me but if you go to the page in question and fill out the form you will see it goes directly to the page '.../contact.php' without actually executing the function.

Could anyone let me know why this is. Here is the .contact.php script which is at my root:

PHP Code:

require_once "Mail.php";


if (!isset(
$_POST['phone']))
{
$_POST['phone'] = "undefine";

$name $_POST['fullname'];
$email $_POST['email'];
$content $_POST['body'];
$from "Client <" $email ">";
//CONFIGURATION PART!
$host "mail.example.com";
$username "smtp_username";
$password "smtp_password";
//-----------------

// EDIT BELOW the mail where you want to receive the orders
$to "Myadress@something.com";
$subject "Client Mail";
$body $name "  ;  " $email "   ;    " $content;
$headers = array ('From' => $from,
  
'To' => $to,
  
'Subject' => $subject);
$smtp Mail::factory('smtp',
  array (
'host' => $host,
    
'auth' => true,
    
'username' => $username,
    
'password' => $password));
$mail $smtp->send($to$headers$body);
if (
PEAR::isError($mail)) {
  echo(
"<p>" $mail->getMessage() . "</p>");
 } else {
  echo(
"<p>Message successfully sent!</p>");
 }
*/
header('Location: [url]http://www.translatepro.net/email_confirmation.html');[/url]

?> 




Here is the contact form script:

HTML Code:
<form method="post" action="contact.php"> 
 
<!-- Personal Details --> 
<fieldset> 
<legend style="margin-bottom:0">Leave us a message!</legend> 
 
<label style="padding-top: 1em">Full Name:</label> 
 
<input type="text" title="Text input: First Name" name="fullname" /> 
 
<label>Email:</label> 
<input type="text" title="Text input: Email" name="email" /> 
 
<label>Questions/Comments:</label> 
 
<textarea rows="20" cols="" name="body"></textarea> 
<br> 
<input type="submit"  name="Submit" class="button-submit" id="Submit" value="Submit"/> 
</fieldset> 
 
</form>

Any Help appreciated, Thanks

Last edited by wirehopper; 03-09-10 at 03:32 PM. Reason: PHP & HTML tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-09-10, 03:36 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Turn on error report. I think you may have syntax errors in contact.php. This should show them to you.

PHP Code:

ini_set('display_errors',1);

error_reporting(E_ALL|E_STRICT); 
If you're going to use this on a production system or live, publicly accessible server, you should find a different script. This one doesn't have any validation or sanitization and would be abused by spammers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-18-10, 06:18 AM
anushi anushi is offline
New Member
 
Join Date: Mar 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Could yor let me know how to creat a PHP send mail script and html form script?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-18-10, 08:02 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Check HotScripts for "PHP contact form" - you should find some nice code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a contact form script that opens like a drop down menu kewinsurance Script Requests 3 01-24-10 08:41 PM
Help with form validation script kevinkhandublin JavaScript 0 11-05-09 09:33 AM
Contact form with Multiple Recipients TheScribe Script Requests 2 10-10-09 06:12 AM
Idea for an opensource form script.. tribune Script Requests 0 06-05-08 03:54 PM
Raffle/Lottery Script (Very profitable!), Coded it myself. Voltaire General Advertisements 2 01-03-06 12:55 AM


All times are GMT -5. The time now is 12:57 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.