Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Contact Form Help

Featured Replies

Hi Folks,

 

I am having some issues in getting our form to work, and I am hoping someone can help. I have used a customised script which I have altered but am still experiencing issues in getting the form to work once a user clicks on 'send message' button.

Is there a simple script i can upload and change, or is there something I need to change to the existing script - see below. Any help or advice would be appreciated.

 

<?php
/* Set e-mail recipient */
$myemail = "dan@definitelydomains.com";
/* Check all form inputs using check_input function */
$name = check_input($_POST['Name']);
$email = check_input($_POST['Email']);
$offerinquiry = check_input($_POST['Offer Inquiry']);
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");
}
/* If URL is not valid set $website to empty */
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
{
$website = '';
}
/* Let's prepare the message for the e-mail */
$message = "Hello!
Your contact form has been submitted by:
Name: $name
E-mail: $email
Offer Inqury:
$offerinquiry
End of message
";
/* Send the message using mail() function */
mail($myemail, $name, $email $offerinquiry);
/* Redirect visitor to the thank you page */
header('Location: thanks.htm');
exit();
/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
exit();
}
?>
  • Author

Thank you - I will check this out.

 

I have added a simple script in the meantime which seems to have worked to a degree. I am now able to receive the email once someone hits 'Send message', but how do i alter this script to include additional comments? The amended script i am using is below -

 

<?php
$ToEmail = 'dan@definitelydomains.com';
$EmailSubject = 'DrivingSupercars';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."";
$MESSAGE_BODY .= "Offer Inquiry: ".nl2br($_POST["offer_inquiry"])."";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
?>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.