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.

Undefined Variable...

Featured Replies

I am currently using the script below to send emails through.....however for some reason it has just started saying I have an undefined variable on line 10....( body_message ).....I am not sure why?? Any ideas? I am not so good with php.....

 

 

<?php

$field_name = $_POST['cf_name'];

$field_email = $_POST['cf_email'];

$field_phone = $_POST['cf_phone'];

$field_message = $_POST['cf_message'];

 

$mail_to = 'email address goes here';

$subject = 'Message from a site visitor '.$field_name;

 

$body_message .= 'From: '.$field_name."\n";

$body_message .= 'E-mail: '.$field_email."\n";

$body_message .= 'Phone: '.$field_phone."\n";

$body_message .= 'Message: '.$field_message;

 

$headers = 'From: '.$field_email."\r\n";

$headers .= 'Reply-To: '.$field_email."\r\n";

 

$mail_status = mail($mail_to, $subject, $body_message, $headers);

 

if ($mail_status) { ?>

<script language="javascript" type="text/javascript">

alert('Thank you for the message. We will contact you shortly.');

window.location = '/index.html';

</script>

<?php

}

else { ?>

<script language="javascript" type="text/javascript">

alert('Message failed. Please, send an email to email address goes here...');

window.location = '/index.html';

</script>

<?php

}

?>

This

 

$body_message .= 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'Message: '.$field_message;

 

should be

 

$body_message = "";
$body_message .= 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Phone: '.$field_phone."\n";
$body_message .= 'Message: '.$field_message;

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.