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.

PHP Form Submit Error

Featured Replies

Visit My Website

 

 

Hi I am having problems with this form, it worked on my servers when I was testing it but when I uploaded it on my clients server it came up with problems. Any help would be appreciated. I have no idea what php version my client is using but its on fasthost business package i think.

 

Notice: Undefined index: comments in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 57

Notice: Undefined variable: email in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 92

Notice: Undefined variable: name in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 93

Warning: mail() [function.mail]: SMTP server response: 554 <general@insurerconnections.com>: Recipient address rejected: Relay access denied in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 103

Notice: Undefined variable: email in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 92

 

Notice: Undefined variable: name in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 93

 

Means you've called a variable that's not been given a value.

 

Notice: Undefined index: comments in E:\domains\i\insurerconnections.com\user\htdocs\scripts\submit-form.php on line 57

 

I think is because of your php error reporting settings, can you post your code?

 

 

Warning: mail() [function.mail]: SMTP server response: 554

 

means that the transaction failed, which can mean a few things, like you don't have the authority/permissions to use the mail() function, or you've been blocked from using it by the host or w.e (i think!).

 

Bear in mind, they're just educated guesses, without the actual code you've used, it's hard to determine for sure.

With regards to "SMTP server response: 554", is your client using a professional hosting company or are they using their own server. If so, they might not have SMTP setup probably in their PHP configuration. If that's the case, we can help you get it working.

 

P.S. The code will help matters :)

  • Author

The host is fasthost, not sure whether its windows or linux.

 

 

 

<?php
//This is a very simple PHP script that outputs the name of each bit of information (that corresponds to the <code>name</code> attribute for that field) along with the value that was sent with it right in the browser window, and then sends it all to an email address (once you've added it to the script).

if (empty($_POST)) {
print "<p>No data was submitted.</p>";
print "</body></html>";
exit();
}

//Creates function that removes magic escaping, if it's been applied, from values and then removes extra newlines and returns to foil spammers.
function clear_user_input($value) {
if (get_magic_quotes_gpc()) $value=stripslashes($value);
$value= str_replace( "\n", '', trim($value));
$value= str_replace( "\r", '', $value);
return $value;
}


if ($_POST['comments'] == 'Please share any comments you have here') $_POST['comments'] = '';	

//Create body of message by cleaning each field and then appending each name and value to it

$body ="Here is the data that was submitted:\n";

foreach ($_POST as $key => $value) {
$key = clear_user_input($key);
$value = clear_user_input($value);
if ($key=='extras') {

if (is_array($_POST['extras']) ){
	$body .= "$key: ";
	$counter =1;
	foreach ($_POST['extras'] as $value) {
			//Add comma and space until last element
			if (sizeof($_POST['extras']) == $counter) {
				$body .= "$value\n";
				break;}
			else {
				$body .= "$value, ";
				$counter += 1;
				}
			}
	} else {
	$body .= "$key: $value\n";
	}
} else {

$body .= "$key: $value\n";
}
}

extract($_POST);
//removes newlines and returns from $email and $name so they can't smuggle extra email addresses for spammers
$email = clear_user_input($email);
$name = clear_user_input($name);

//Create header that puts email in From box along with name in parentheses and sends bcc to alternate address
$from='From: '. $email . "(" . $name . ")" . "\r\n" . 'Bcc: 'general@insurerconnections.com' . "\r\n";


//Creates intelligible subject line that also shows me where it came from
$subject = 'InsurerConnections.com - GENERAL';

//Sends mail to me, with elements created above
mail ('general@insurerconnections.com', $subject, $body, $from);


?>

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.