"Warning: mail() expects at most 5 parameters, 9 given in /home/username/public_html/process-form.php on line 23 Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html/process-form.php:23) in /home/backstab/public_html/process-form.php on line 26" Not sure what im doing wrong..? Thanks.
Post the code for the mail section. Second part means you are trying to modify the headers for the webpage after you have already sent the headers. You can't modify the headers if you have started outputting the webpage. Once again, code helps. Just try to post the important parts. line 20- 26+.
Actually, the second error message is caused because the first error message is being output first. If we fix the mail() problem, the header problem will go away too, most likely.
<?php // Pick up the form data and assign it to variables $Firstname = $_POST['Firstname']; $Lastname = $_POST['Lastname']; $Email = $_POST['Email']; $Job = $_POST['Job']; $Details = $_POST['Details']; $Budget = $_POST['Budget']; $Domain = $_POST['Domain']; // Build the email (replace the address in the $to section with your own) $to = 'myemail@email.com'; $subject = "Quote Request"; $Firstname = "Firstname"; $Lastname = "Lastname"; $Email = "Email"; $Job = "Job"; $Details = "Details"; $Budget = "Budget"; $Domain = "Domain"; // Send the mail using PHPs mail() function mail($to, $subject, $Firstname, $Lastname, $Email, $Job, $Details, $Budget, $Domain); // Redirect header("Location: success.html");
You have to sandwich the rest of that into the message. Plus you didn't define the headers to be sent. Here's an example from w3schools: <?php $to = "someone@example.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Code (markup): Adapting that to your code would require pushing the $firstname $lastname $job $domain to the $message variable. $message = $Firstname . $Lastname . $job . $domain; Then redirect to the success page but really should set it up so it checks for success or failure and reports accordingly.
For the love of god please use $firstname instead of $Firstname. Never capitalize the first letter of a variable. Capital letters are to be used for classes.