| | |
Mail Function syntax error
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 12
Reputation:
Solved Threads: 0
I am trying to put a variable in as the value of the mail function on my script. I am relatively new to php and I may be making a simple mistake. Here is the script:
and here is the error I am getting:
PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 44
Thanks in advance.
php Syntax (Toggle Plain Text)
$busmail = $_POST['field_2'] mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed. Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> ");
and here is the error I am getting:
PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 44
Thanks in advance.
•
•
Join Date: Feb 2008
Posts: 12
Reputation:
Solved Threads: 0
Here is the entire script so you can see which line is 44.
php Syntax (Toggle Plain Text)
<?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // File upload handling if($_FILES['field_6']['name']!=''){ $field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4); if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){ die("File " . $_FILES['field_6']['name'] . " was not uploaded."); } } include("config.inc.php"); $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `".$db_table."` (field_1,field_2,field_3,field_4,field_5,field_6,field_7,field_8,field_9,field_10,field_11,field_12,field_13,field_14) VALUES ('" . $_POST['field_1'] . "','" . $_POST['field_2'] . "','" . $_POST['field_3'] . "','" . $_POST['field_4'] . "','" . $_POST['field_5'] . "','" . $_POST['field_6'] . "','" . $_POST['field_7'] . "','" . $_POST['field_8'] . "','" . $_POST['field_9'] . "','" . $_POST['field_10'] . "','" . $_POST['field_11'] . "','" . $_POST['field_12'] . "','" . $_POST['field_13'] . "','" . $_POST['field_14'] . "')"; mysql_query($query); mysql_close($link); mail("","phpFormGenerator - Form submission","Form data: Customer Name: " . $_POST['field_1'] . " Customer Email: " . $_POST['field_2'] . " Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ") Shipping Information: " . $_POST['field_7'] . " Ship to Address: " . $_POST['field_8'] . " Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . " Alterations: " . $_POST['field_10'] . " : " . $_POST['field_11'] . " : " . $_POST['field_12'] . " : " . $_POST['field_13'] . " : " . $_POST['field_14'] . " "); $busmail = $_POST['field_2'] mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed. Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> "); include("confirm.html"); ?>
•
•
Join Date: Nov 2007
Posts: 121
Reputation:
Solved Threads: 16
PHP Syntax (Toggle Plain Text)
mail(" . $busmail . ","Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
needs to be
PHP Syntax (Toggle Plain Text)
mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed.
•
•
Join Date: Feb 2008
Posts: 12
Reputation:
Solved Threads: 0
Ok, took out the quotes and still getting an error code. The error will follow after the code insert in this post.
PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 44
php Syntax (Toggle Plain Text)
<?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // File upload handling if($_FILES['field_6']['name']!=''){ $field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4); if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){ die("File " . $_FILES['field_6']['name'] . " was not uploaded."); } } include("config.inc.php"); $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `".$db_table."` (field_1,field_2,field_3,field_4,field_5,field_6,field_7,field_8,field_9,field_10,field_11,field_12,field_13,field_14) VALUES ('" . $_POST['field_1'] . "','" . $_POST['field_2'] . "','" . $_POST['field_3'] . "','" . $_POST['field_4'] . "','" . $_POST['field_5'] . "','" . $_POST['field_6'] . "','" . $_POST['field_7'] . "','" . $_POST['field_8'] . "','" . $_POST['field_9'] . "','" . $_POST['field_10'] . "','" . $_POST['field_11'] . "','" . $_POST['field_12'] . "','" . $_POST['field_13'] . "','" . $_POST['field_14'] . "')"; mysql_query($query); mysql_close($link); mail("","phpFormGenerator - Form submission","Form data: Customer Name: " . $_POST['field_1'] . " Customer Email: " . $_POST['field_2'] . " Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ") Shipping Information: " . $_POST['field_7'] . " Ship to Address: " . $_POST['field_8'] . " Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . " Alterations: " . $_POST['field_10'] . " : " . $_POST['field_11'] . " : " . $_POST['field_12'] . " : " . $_POST['field_13'] . " : " . $_POST['field_14'] . " "); $busmail = $_POST['field_2'] mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed. Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> "); include("confirm.html"); ?>
PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 44
php Syntax (Toggle Plain Text)
$busmail = $_POST['field_2'];
you forgot the semi colon on this line.
line 42.
•
•
Join Date: Feb 2008
Posts: 12
Reputation:
Solved Threads: 0
Ok Guys,
This is for you in particular, Ryan. Thanks for the help so far. I feel that this may be the last issue with the script.
PHP Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web171/b1716/sl.c2cadmin/C2C/Form/processor.php on line 51
This is for you in particular, Ryan. Thanks for the help so far. I feel that this may be the last issue with the script.
php Syntax (Toggle Plain Text)
<?php $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); // File upload handling if($_FILES['field_6']['name']!=''){ $field_6_filename = "file_6_".date("sihdmY").substr($_FILES['field_6']['name'],strlen($_FILES['field_6']['name'])-4); if(!move_uploaded_file($_FILES['field_6']['tmp_name'], "./files/".$field_6_filename)){ die("File " . $_FILES['field_6']['name'] . " was not uploaded."); } } include("config.inc.php"); $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `".$db_table."` (field_1,field_2,field_3,field_4,field_5,field_6,field_7,field_8,field_9,field_10,field_11,field_12,field_13,field_14) VALUES ('" . $_POST['field_1'] . "','" . $_POST['field_2'] . "','" . $_POST['field_3'] . "','" . $_POST['field_4'] . "','" . $_POST['field_5'] . "','" . $_POST['field_6'] . "','" . $_POST['field_7'] . "','" . $_POST['field_8'] . "','" . $_POST['field_9'] . "','" . $_POST['field_10'] . "','" . $_POST['field_11'] . "','" . $_POST['field_12'] . "','" . $_POST['field_13'] . "','" . $_POST['field_14'] . "')"; mysql_query($query); mysql_close($link); mail("","phpFormGenerator - Form submission","Form data: Customer Name: " . $_POST['field_1'] . " Customer Email: " . $_POST['field_2'] . " Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Upload Your Image Here: ".$where_form_is."files/".$field_6_filename." (original file name: " . $_FILES['field_6']['name'] . ") Shipping Information: " . $_POST['field_7'] . " Ship to Address: " . $_POST['field_8'] . " Please read and check this option or your image will not be reproduced.: " . $_POST['field_9'] . " Alterations: " . $_POST['field_10'] . " : " . $_POST['field_11'] . " : " . $_POST['field_12'] . " : " . $_POST['field_13'] . " : " . $_POST['field_14'] . " "); $busmail = $_POST['field_2']; mail($busmail, "Order Confirmation","Your Order Has Been Received And Is Now Being Processed. Quantity: " . $_POST['field_3'] . " Size: " . $_POST['field_4'] . " Special Instructions: " . $_POST['field_5'] . " Please contact us with any questions or concerns at <A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A> "); include("confirm.html"); ?>
change the double quote here:
to single quote:
php Syntax (Toggle Plain Text)
<A href="mailto:c2c@capturedtocanvas.com" target=_top>c2c@capturedtocanvas.com</A>
to single quote:
php Syntax (Toggle Plain Text)
<A href='mailto:c2c@capturedtocanvas.com' target=_top>c2c@capturedtocanvas.com</A>
or to keep proper html syntax you could do this:
PHP Syntax (Toggle Plain Text)
<A href=\"mailto:c2c@capturedtocanvas.com\" target=_top>c2c@capturedtocanvas.com</A>
Last edited by kkeith29; Mar 6th, 2008 at 10:34 pm.
![]() |
Similar Threads
- smtp mail in php (PHP)
- Help me please. (PHP)
- Sending Mails with PHP (PHP)
- PHP Mail Error (PHP)
- PHP - subscribers' email (PHP)
- Warning: mysql_num_rows(): (PHP)
- Phonebook program! (C)
- Browser Battle -- Your TOP Pick! (Geeks' Lounge)
Other Threads in the PHP Forum
- Previous Thread: Send mail in localhost?
- Next Thread: MESSAGE BOARD USER IDENTIFICATION AND DELETE MESSAGE HELP?
Views: 1975 | Replies: 10
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






