logo
down
shadow

Why is my contact form PHP script not working? No error log


Why is my contact form PHP script not working? No error log

By : zizar
Date : November 21 2020, 11:01 PM
will be helpful for those in need White screen usually means internal or syntax error
PHP, unlike JavaScript doesn't let you get away with missing semicolons or curly braces. First, make sure your code is syntactically valid and without typos before going on to fixing the logic. Errors can be displayed in most cases by including the following lines at the top of your PHP file:
code :
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
<form action="whatever.php" method="POST">
  <input type="text" name="my_text_input">
</form>
<?php

$myTextBoxValue = $_POST['my_text_input'];

?>


Share : facebook icon twitter icon
Error: SMTPRecipientsRefused 553, '5.7.1 #while working on contact form in django

Error: SMTPRecipientsRefused 553, '5.7.1 #while working on contact form in django


By : PubHealth_Geek
Date : March 29 2020, 07:55 AM
I wish did fix the issue. The explanation is in the error message. Your email host is rejecting the email because of the sender address randomacc@hotmail.com that you have taken from the contact form.
Instead, you should use your own email address as the sender address. You can use the reply_to option so that replies go to your user.
code :
email = EmailMessage(
    'Subject',
    'Body goes here',
    'test@test.megiteam.pl',
    ['to@example.com',],
    reply_to='randomacc@hotmail.com',
)
email.send()
email = EmailMessage(
    'Subject',
    'Body goes here',
    'test@test.megiteam.pl',
    ['to@example.com',],
    headers = {'Reply-To': 'randomacc@hotmail.com'},
)
email.send()
from django.conf import settings

...
    if form.is_valid():
        cd = form.cleaned_data
        message = cd['message']
        # construct the message body from the form's cleaned data
        body = """\
from: %s
message: %s""" % (cd['email'], cd['message'])
        send_mail(
            cd['subject'],
            body,
            settings.DEFAULT_FROM_EMAIL, # use your email address, not the one from the form
            ['test@test.megiteam.pl'],
        )
posting a footer contact form to a different script not working

posting a footer contact form to a different script not working


By : Ин Ко
Date : March 29 2020, 07:55 AM
Extend contact form validation PHP script with some error messages

Extend contact form validation PHP script with some error messages


By : user7443057
Date : March 29 2020, 07:55 AM
this one helps. Below is the code for a contact form validation script that I would like to extend.
code :
<?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $from = 'From: DaVv'; 
    $to = 'mail@mail.com'; 
    $subject = 'The topic';

    $body = "From: $name\n E-Mail: $email\n Message:\n $message";

    if(isset($_POST['submit']))
    {
        if(filter_var($email, FILTER_VALIDATE_EMAIL) !== false)
        {               
            if(mail ($to, $subject, $body, $from))
                echo '<p>Your message has been sent!</p>';
            else
                echo '<p>Something went wrong, go back and try again!</p>'; 
        }
        else
            echo '<p>Wrong Email</p>';

    }
    else if(!isset($_POST['submit']))
        echo '<p>You answered the anti-spam question incorrectly!</p>';
?>
PHP Contact Form not working. Getting internal server error 500

PHP Contact Form not working. Getting internal server error 500


By : Eslam Aboudesheesh
Date : March 29 2020, 07:55 AM
it fixes the issue To get variable values in PHP, use $_POST['variableName']
for example to fetch this:
code :
<input type="text" name="email">
$email= $_POST['email']; 


<?php
// Contact subject
$subject = $_POST['subject']; 
// Details
$message=$_POST['message'];

// Mail of sender
$mail_from=$_POST['email']; 
// From 
$header="from: ".$_POST['name']." <".$_POST['email'].">";

// Enter your email address
$to ="example@example.com";

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
    header('Location: confirm.html'); 
}    
else {
echo "ERROR";
}
?>
$to = "webtest@website.com";
$subject = "Test Email";
$message = "Test Email";

// normal headers
$num = md5(time()); 
$headers  = "From: Me <me@website.com>\r\n";
$headers  .= "MIME-Version: 1.0\r\n";
$headers  .= "Content-Type: multipart/mixed; ";
$headers  .= "boundary=".$num."\r\n";
$headers  .= "--$num\r\n";

// This two steps to help avoid spam   

$headers .= "Message-ID: <".time()." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n";
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";         

// With message

$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "".$message."\n";
$headers .= "--".$num."\n"; 


@mail($to, $subject, $message, $headers);
Contact form gives error, does not trigger action php script

Contact form gives error, does not trigger action php script


By : SageDvA
Date : March 29 2020, 07:55 AM
I wish this helpful for you First ensure that you have contact.php in php folder and also check whether your html form is reaching to php code or not because i can see onclick method in your html form .if your html form is reaching to php then
you have problem in isEmail($email) function .if you are using isemail function then you have to return true because you are checking else if(!isEmail($email)) { in validation please update as below
code :
function isEmail($email) { 

     return filter_var($email, FILTER_VALIDATE_EMAIL);
     }
  function isEmail($email) { 

         return filter_var($email, FILTER_VALIDATE_EMAIL);
         }

if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n");

$name     = $_POST['name'];
$email    = $_POST['email'];
$content = $_POST['comments'];


if(trim($name) == '') {
    echo '<div class="error_message">Enter your name.</div>';
    exit();
} else if(trim($email) == '') {
    echo '<div class="error_message">Enter a valid email address.</div>';
    exit();
} else if(!isEmail($email)) {
    echo '<div class="error_message">You have enter an invalid e-mail address, try again.</div>';
    exit();
} else if(trim($content) == '') {
    echo '<div class="error_message">Enter your message.</div>';
    exit();
} 

if(get_magic_quotes_gpc()) {
    $comments = stripslashes($comments);
}

$emailTo = "e.lucinskas@hotmail.co.uk";

$subject = 'Youve been contacted by ' . $name . '.';

$e_body = "You have been contacted by: $name" . PHP_EOL . PHP_EOL;
$e_reply = "E-mail: $email\r\nPhone: $phone";
$e_content = "Message:\r\n$comments" . PHP_EOL . PHP_EOL;

//$content = wordwrap( $e_body . $e_content . $e_reply, 70 );

$headers = "From: $email" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;

if(mail($emailTo, $subject, $content, $headers)) {

    echo "<fieldset>";
    echo "<div id='success_page'>";
    echo "<h3>Email Sent Successfully.</h3>";
    echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>";
    echo "</div>";
    echo "</fieldset>";

} else {

    echo 'ERROR!';
}
Related Posts Related Posts :
  • Set up Phalcon 3.0.x with Php 7.0.x in ubuntu16.04
  • Server picking up old files
  • CSS loading after HTML loads
  • Getting an error for double and boolean even boolean given
  • Create shipment using fedex api (php)
  • How to get the variable value from one controller to another controller?
  • Bind doesn't work on User model
  • Sort JSON date by date - PHP
  • apache log is filled with erros and warnings almost 25 gb each time
  • Chrome adding tags (#shadow-root (open))
  • Split an array based on the value of another array
  • CodeIgniter Calendar Preferences template not working
  • .htaccess mode rewrite does not affect page url
  • PHP Laravel 5 : Trait not found
  • php count values column
  • Ajax POST not recognised as part of current guest session, Laravel 5.3
  • Sorting racers / players by places
  • cURL empty request data if https connection
  • PHP/MYSQL - Multiple connections to the same database?
  • PHP: Handle only parents on array
  • PHP IF How to include multiple conditions?
  • Basic PHP contact form receiving email but no message
  • Change price location in Woocommerce Single Product Layout
  • Turn string to array in PHP (all data recorder as string)
  • Sorting issues with mySQL JOIN
  • Get keys from multidimentional array by value
  • php accessing variables in constructor from included file
  • Mysqli can't insert multiple rows
  • PHP Substracting 1 day from date string php doesnt work
  • How to know the column name on yii2 Gridview
  • How to preg_match() a variable from file_get_contents()
  • How can we use search conditions (.. and ..or..) for columns instead of rows in mysql?
  • Ternary operator - unexpected behavior
  • I cant retrieve the value of $_COOKIE['mycookiename'] when request sent to server with ajax
  • Message could not be sent.Mailer Error: SMTP connect() failed
  • Get error before they execute the error message function
  • Convert CI_Model to JSON and then Send to AJAX
  • How to convert Localtime to user seleted timezone in php
  • fopen to add variable to file
  • Values from checkbox group are correct in querystring, but are not arrays in the $_GET variable
  • Is die function accept only strings?
  • Remove category from woocommerce loop on custom shop page
  • Perform word match in a String until another word is found in the String
  • Codeigniter callbacks affecting required validation
  • PHP execution in a hidden way
  • Adding data to DB fails without an error - Laravel
  • Php pdo iterate with sequence
  • How to get the route its structure in Laravel
  • Laravel HTTP status code "1" is not valid error
  • execute a python code from php and take the return value back to the php code example
  • Cant share Auth::check() in App\Http\Controllers\Controller via view()->share
  • Wordpress AJAX: Get a function as Json response
  • Use custom fields in registration email for Wordpress Cimy
  • Swift_SmtpTransport phalcon
  • How to retrieve data from multiple Google Analytics accounts using Google API?
  • Add xmlhttprequest inside a PHP post request
  • sorting mongo regex query in php
  • Can not leverage browser caching in codeigniter using htaccess
  • Create descendant class based on Eloquent model
  • XML PHP Login Error
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com