Contact Form 7 cause HTTP 500 error
You need change in .htaccess file and in local setup folder name set as "wordpress" but in live site we have to change this name.
Before
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agilitycards/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agilitycards/index.php [L]
</IfModule>
# END WordPress
You need to replace with below code in .htaccess file.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
php form keeps giving me 500 error
It looks like on your form you forgot to include the name for the textarea which is causing an undefined index in the code when trying to get
$_POST['message']
<textarea name="message" id="message" required></textarea>
Doing the above resolved the issue in testing for me.
html/php form gives me 500 internal server error when adding more input fields
6 Variables will result in:
Warning: mail() expects at most 5 parameters, 6 given in YOUR WEBSITE on LINE
Solution example:
<?php
//var_dump($_POST);
if (isset($_POST["subject"]))
{
$subject = $_POST["subject"];
$message = $_POST["message"];
$first = $_POST["first_name"];
$last = $_POST["last_name"];
$name= "$first $last";
}
$message = wordwrap($message, 70);
$first = wordwrap($first, 70);
$last = wordwrap($last, 70);
mail("summat@gmail.com",$subject,$message,$name,"subject: $subject\n");
echo "Thank you for sending us feedback";
?>
Answer to your reply:
Php:
<?php
//var_dump($_POST);
if (isset($_POST["subject"]))
{
$subject = $_POST["subject"];
$message = $_POST["message"];
$first = $_POST["first_name"];
$last = $_POST["last_name"];
$company = $_POST["company"];
$email = $_POST["email"];
$telnr = $_POST["telnr"];
$description = $_POST["description"];
$therest = "First name= $first" . "\r\n" . "Last name= $last" . "\r\n" . "Last name= $last" . "\r\n" . "Company= $company" . "\r\n" . "Email= $email" . "\r\n" . "Telnr= $telnr" . "\r\n" . "Description= $description";
//echo "$therest <br>";
$message = wordwrap($message, 70);
$first = wordwrap($first, 70);
$last = wordwrap($last, 70);
mail("Your Email Address Here",$subject,$name,$therest,"subject: $subject\n");
echo "Thank you for sending us feedback";
}
HTML
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<input type="hidden" name="subject" value="can you create me an account"><br>
Message: <textarea rows="10" cols="40" name="message"></textarea><br>
first <input type="text" name="first_name" ><br>
last <input type="text" name="last_name" ><br>
company <input type="text" name="company" ><br>
email <input type="text" name="email" ><br>
Telephone number <input type="text" name="telnr" ><br>
Description <input type="text" name="description" ><br>
<input type="submit" name="submit" value="Submit Feedback">
</form>
Demo: here
It will send the mail to the mail your entered in the form
POST error 500: Internal server error
I also had the same issue with the form handling.
The solution is to clear the cache manually and warm up it again.
php app/console cache:clear ==> Does'nt work for me, so I do:
rm -rf app/cache/dev
php app/console cache:warmup
That fix the problem!
But what was the issue?
I figure out that 500 Internal Server Error get's thrown becaus it try's to load the cached routing values in app/cache/dev/annotations (in my case)
Hint: I have used annotation for templating and routing before in the controller. Than I've chang this and now I'm using external file routing... And that was my pain... I've forgotten to clear the cache manually!!!
Related Topics
How to Iterate Utf-8 String in PHP
How to Parameterize the Table Name in a Prepared Statement
How to Send a Post Request With PHP
How to Get Woocommerce Order Details
Call to a Member Function on a Non-Object
How to Generate Unique Random Value for Each User in Laravel and Add It to Database
Option Selected With Codeigniter and Data from Db
Laravel, Failed to Authenticate on Smtp Server With Username "" Using 3 Possible Authenticators
Tell Composer to Use Different PHP Version
How to Get Username from Facebook Id
How to Get Foreach Loop Variable Outside of Loop
The Get Method Is Not Supported for This Route. Supported Methods: Put. But I'M Using Put
Laravel - Display a Pdf File in Storage Without Forcing Download
Converting Soap Xml Response to a PHP Object or Array