<? $mailto = 'myemail@gmail.com' ; $subject = "Feedback Form" ; $formurl = "http://www.domain.com/form.html" ; $errorurl = "http://www.domain.com/error.html" ; $thankyouurl = "http://www.domain.com/thanks.html" ; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $email = $_POST['email']; $company = $_POST['company']; $comments = $_POST['comments'] $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($email)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" "Name: $name\n" "Email: $email\n" "Company or brand Name: $company\n" "Brief Project Description: $comments\n" . "------------------------- Message -------------------------\n\n" . "I am subscribing.\n" . "Email of sender: $email\n" . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$email\" <$email>" . $headersep . "Reply-To: \"$email\" <$email>" . $headersep . "X-Mailer: feedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ; ?> this is the error i get when i click on submit button: Parse error: syntax error, unexpected T_VARIABLE in /home/a2124567/public_html/feedback.php on line 15 plus i am using free webhosting of 000webhost. kindly help me out
yeah i did that but this time it is giving error on line 33 and line 33 is the next line to ['comment']; which is actualy a empty line. previously it was giving error on line 15 on which there is a code $uself = 0 what could be the problem?
Something like this should work. You've just missed a lot of dots and semicolons. Try to organize your code so you can read it better. <?php $mailto = 'myemail@gmail.com'; $subject = 'Feedback Form'; $formurl = 'http://www.domain.com/form.html'; $errorurl = 'http://www.domain.com/error.html'; $thankyouurl = 'http://www.domain.com/thanks.html'; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset($uself) || ($uself == 0)) ? "\r\n" : "\n"; $name = $_POST['name'] ; $email = $_POST['email']; $company = $_POST['company']; $comments = $_POST['comments']; $http_referrer = getenv('HTTP_REFERER'); if ( !isset($_POST['email']) ) { header( "Location: $formurl" ); exit; } if ( empty($email) ) { header( "Location: $errorurl" ); exit; } if ( ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit; } $messageproper = "This message was sent from:\n"; $messageproper .= "$http_referrer\n"; $messageproper .= "------------------------------------------------------------\n"; $messageproper .= "Name: $name\n"; $messageproper .= "Email: $email\n"; $messageproper .= "Company or brand Name: $company\n"; $messageproper .= "Brief Project Description: $comments\n"; $messageproper .= "------------------------- Message -------------------------\n\n"; $messageproper .= "I am subscribing.\n"; $messageproper .= "Email of sender: $email\n"; $messageproper .= "\n\n------------------------------------------------------------\n"; $from = "From: \"$email\" <$email>" .$headersep ."Reply-To: \"$email\" <$email>" .$headersep ."X-Mailer: feedback.php 2.07"; mail($mailto, $subject, $messageproper, $from); header("Location: $thankyouurl"); exit; PHP: Anyway, you should get rid of ereg in your code as it is deprecated now...
yeah i did exactly same but again it is giving me error on different line. i doubt may be its due to the hosting service but my other website contact form is working fine
Have you copy pasted my code and you're still getting an error? On what line? What is the error message?