Newbie Spellweaver
- Joined
- Jun 17, 2012
- Messages
- 5
- Reaction score
- 0
Hello. I am kinda new in PHP code, so i am currently needing for help in this tricky situation.
I have created simple form to my "Order.html".
And here is my "not working" php.
I am currently trying to add (actually i have added) this part of html
file to my feedback.php , but it dont work. I have no idea how to fix this.
I have created simple form to my "Order.html".
Code:
<form action="feedback.php" method="post" class="text4">
<center>
<table border="0" cellpadding="1" cellspacing="3">
<tr><td><label for="tswname">Name</label>:</td><td><input type="text" name="fullname" id="tswname" size="25" /></td></tr>
<tr><td><label for="tswemail">Email address:</label></td><td><input type="text" id="tswemail" name="email" size="25" /></td></tr>
<tr><td><label for="tswnumber">Telephone Number:</label></td><td><input type="text" id="tswnumber" name="number" size="25" /></td></tr>
<tr><td><label for="tswproducts">Products:</label></td><td><select name="products" id="tswproducts" />
<option>Cheese</option>
<option>Ham with Cheese</option>
<option>Shrimp with Cheese</option>
</select></td></tr>
<tr><td><label for="tswamount">Amount:</label></td><td><select name="amount" id="tswamount" />
<option>20</option>
<option>50</option>
</select></td></tr>
<tr>
<td colspan="2">
<br />
<br />
<label for="tswcomments">More Info:</label><br />
<textarea rows="3" cols="45" name="comments" id="tswcomments"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
<input type="submit" value="Send Order" /><br />
</td>
</tr>
</table>
</center>
</form>
And here is my "not working" php.
PHP:
<?php
$mailto = 'info@lccompany.be' ;
$subject = "LC Company Order" ;
$formurl = "http://lccompany.be/order.html" ;
$thankyouurl = "http://lccompany.be/orderthankyou.html" ;
$errorurl = "http://lccompany.be/ordererror.html" ;
$email_is_required = 1;
$name_is_required = 1;
$number_is_required = 1;
$comments_is_required = 1;
$uself = 0;
$forcelf = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$smtp_server_win = '' ;
$use_webmaster_email_for_from = 0;
$use_utf8 = 1;
$my_recaptcha_private_key = '' ;
define( 'MAX_LINE_LENGTH', 998 );
$headersep = $uself ? "\n" : "\r\n" ;
$content_nl = $forcelf ? "\n" : (defined('PHP_EOL') ? PHP_EOL : "\n") ;
$content_type = $use_utf8 ? 'Content-Type: text/plain; charset="utf-8"' : 'Content-Type: text/plain; charset="iso-8859-1"' ;
if ($use_sendmailfrom) {
ini_set( 'sendmail_from', $mailto );
}
if (strlen($smtp_server_win)) {
ini_set( 'SMTP', $smtp_server_win );
}
$envsender = "-f$mailto" ;
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : $_POST['name'] ;
$email = $_POST['email'] ;
$number = $_POST['number'] ;
$products = $_POST['products'] ;
$amount = $_POST['amount'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($products_is_required && empty($products)) || ($amount_is_required && empty($amount)) || s($number_is_required && empty($number)) || ($comments_is_required && empty($comments))) {
header( "Location: $errorurl" );
exit ;
}
if ( preg_match( "/[\r\n]/", $fullname ) || ( preg_match( "/[\r\n]/", $number ) || ( preg_match( "/[\r\n]/", $products ) || ( preg_match( "/[\r\n]/", $amount ) || ( preg_match( "/[\r\n]/", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
if (strlen( $my_recaptcha_private_key )) {
require_once( 'wnk1ee's website/recaptchalib.php' );
$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
if (!$resp->is_valid) {
header( "Location: $errorurl" );
exit ;
}
}
if (empty($email)) {
$email = $mailto ;
}
$fromemail = $use_webmaster_email_for_from ? $mailto : $email ;
if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:" . $content_nl .
"$http_referrer" . $content_nl .
"------------------------------------------------------------" . $content_nl .
"Name of sender: $fullname" . $content_nl .
"Email of sender: $email" . $content_nl .
"Telephone number of sender: $number" . $content_nl .
"Product of sender: $products" . $content_nl .
"Desired Amount: $amount" . $content_nl .
"------------------------- COMMENTS -------------------------" . $content_nl . $content_nl .
wordwrap( $comments, MAX_LINE_LENGTH, $content_nl, true ) . $content_nl . $content_nl .
"------------------------------------------------------------" . $content_nl ;
$headers =
"From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.2" .
$headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
header( "Location: $thankyouurl" );
exit ;
?>
I am currently trying to add (actually i have added) this part of html
Code:
<tr><td><label for="tswnumber">Telephone Number:</label></td><td><input type="text" id="tswnumber" name="number" size="25" /></td></tr>
<tr><td><label for="tswproducts">Products:</label></td><td><select name="products" id="tswproducts" />
<option>Cheese</option>
<option>Ham with Cheese</option>
<option>Shrimp with Cheese</option>
</select></td></tr>
<tr><td><label for="tswamount">Amount:</label></td><td><select name="amount" id="tswamount" />
<option>20</option>
<option>50</option>
</select></td></tr>
<tr>