Jump to content

Php Code Error - Html Fields Post By Mail


acmoreu

Recommended Posts

Dear readers and coders, I have to recognize I do not have any idea on coding, but not having enought fund to hire a coder I have to do it myself, but some time I cannot solve the issue, and that is the reason I am posting this topic.

I need a Html form trasmiting to a PHP code all fields and this last sending it to my email account. For that I got a free basic code and try to modify to my need but without success. The script give an error when all fields are listed in the mail (?) working fine just with the original field "$Comments". Can any of you tell me the problem or get this script to work. I award with 10 USD paid by paypal to the first put this code to work properly.

 

###### Script #############

 

<?php

$to = "acmoreu@terra.es";

ini_set("SMTP","localhost");

$quotation_page = "quotation_form.html";

$error_page = "error_message.html";

$thankyou_page = "thank_you.html";

$company = $_REQUEST['company'] ;

$name = $_REQUEST['name'] ;

$phone = $_REQUEST['phone'] ;

$email_address = $_REQUEST['email_address'] ;

$products = $_REQUEST['products'] ;

$items = $_REQUEST['items'] ;

$area = $_REQUEST['area'] ;

$date = $_REQUEST['date'] ;

$address = $_REQUEST['address'] ;

$city = $_REQUEST['city'] ;

$province = $_REQUEST['province'] ;

$country = $_REQUEST['country'] ;

$comments = $_REQUEST['comments'] ;

function isInjected($str) {

$injections = array('(\n+)',

'(\r+)',

'(\t+)',

'(%0A+)',

'(%0D+)',

'(%08+)',

'(%09+)'

);

$inject = join('|', $injections);

$inject = "/$inject/i";

if(preg_match($inject,$str)) {

return true;

}

else {

return false;

}

}

// If the user tries to access this script directly, redirect them to the quotation form,

if (!isset($_REQUEST['email_address'])) {

header( "Location: $quotation_page" );

}

// If the form fields are empty, redirect to the error page.

elseif (empty($email_address) || empty($comments)) {

header( "Location: $error_page" );

}

// If email injection is detected, redirect to the error page.

elseif ( isInjected($email_address) ) {

header( "Location: $error_page" );

}

// If we passed all previous tests, send the email then redirect to the thank you page.

else {

mail( "$to", "Quotation Request - Flexypatch",

"$company", "$name", "$phone", $products, $items, $area, $date, $address, $city, $province, $country, $comments, "From: $email_address" );

header( "Location: $thankyou_page" );

}

?>

 

############# Errors ###################

 

Warning: mail() expects at most 5 parameters, 15 given in D:\hshome\klassmar\flexypatch.com\Quotation\send_mail.php on line 59

 

Warning: Cannot modify header information - headers already sent by (output started at D:\hshome\klassmar\flexypatch.com\Quotation\send_mail.php:59) in D:\hshome\klassmar\flexypatch.com\Quotation\send_mail.php on line 60

 

I can provide the html pages code of the filling form, if need.

 

Thanks!

error_message.html

quotation_form.html

send_mail.php

thank_you.html

Edited by acmoreu
Link to comment
Share on other sites

The error message is telling you what is going on...you're giving too many parameters to mail().

 

What you need to do is combine all the fields you want in the email into a variable named something like $message, and then look at the manual page for mail().

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.