• PHP Help
  • Concatenation errors on submision form

Please can someone assist I am new to the whole PHP thing and have simple submission form sample that is giving errors

<?php

#Receive user input
$feedback = "Email Address:"  = $_POST['email_address']."\r\n"
.= "Make: " $_POST['make']."\r\n"
.= "Model: "$_POST['model']."\r\n";
$email_address = $_POST['email_address'];



#Filter user input
function filter_email_header($form_field) {  
return preg_replace('/[nr|!/<>^$%*&]+/','',$form_field); } $email_address = filter_email_header($email_address); #Send email $headers = "From: The best website on the planet"; $sent = mail('john@doe.co.za', 'Feedback Form Submission', $feedback, $headers); #Thank user or notify them of a problem if ($sent) { ?><html> <head> <title>Thank You</title> </head> <body> <h1>Thank You</h1> <p>Thank you for your feedback.</p> </body> </html> <?php } else { ?><html> <head> <title>Something went wrong</title> </head> <body> <h1>Something went wrong</h1> <p>We could not send your feedback. Please try again.</p> </body> </html> <?php } ?>

The browser simply comes back and says that the URL is currently unable to handle the request

    CarolLonghurst

    $feedback = "Email Address:"  = $_POST['email_address']."\r\n"
    .= "Make: " $_POST['make']."\r\n"
    .= "Model: "$_POST['model']."\r\n";

    The second = should be a . and so should the subsequence .=s.

    $feedback = "Email Address:" . $_POST['email_address'] . "\r\n"
        . "Make: " $_POST['make'] . "\r\n"
        . "Model: "$_POST['model'] . "\r\n";

      PS, note that this forum works best when you wrap code blocks in [code]...[/code] tags, rather than using the </> button in the edit window that just wraps the text in a single "back-tick" characters. Yeah, wish the forum would update to make that a clickable option, but... 🤷 I edited your original post accordingly.

        Write a Reply...