Coding Error
Posted: Mon Apr 02, 2012 1:18 am
I\'ve created a PHP form on the contact page of this site www.blindngood.com.au/contact.html using a template from a tutorial I found online.
I'm having a problem with the Mail Form. I built everything as instructed, and uploaded it. Now, when I go online and complete the form and submit it, I get the following error message:
Notice: Undefined index: comments in /clientdata/zeus-dynamic-1/b/l/blindngood.com.au/www/php/mail_form.php on line 44
I get similar error messages for lines: 44, 48, 51, 55 & 59. Here is those lines 43-60 within the code:
foreach ($badwords as $word)
if (strpos($_POST['comments'], $word) !== false)
$points += 2;
foreach ($exploits as $exploit)
if (strpos($_POST['comments'], $exploit) !== false)
$points += 2;
if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false)
$points += 2;
if (isset($_POST['nojs']))
$points += 1;
if (preg_match("/(<.*>)/i", $_POST['comments']))
$points += 2;
if (strlen($_POST['name']) < 3)
$points += 1;
if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
$points += 2;
Is anyone able to suggest where I'm going wrong?
Do you think if I just remove parts of the code, the form would work, or have I done something else wrong?
Hoping someone can help me!
I'm having a problem with the Mail Form. I built everything as instructed, and uploaded it. Now, when I go online and complete the form and submit it, I get the following error message:
Notice: Undefined index: comments in /clientdata/zeus-dynamic-1/b/l/blindngood.com.au/www/php/mail_form.php on line 44
I get similar error messages for lines: 44, 48, 51, 55 & 59. Here is those lines 43-60 within the code:
foreach ($badwords as $word)
if (strpos($_POST['comments'], $word) !== false)
$points += 2;
foreach ($exploits as $exploit)
if (strpos($_POST['comments'], $exploit) !== false)
$points += 2;
if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false)
$points += 2;
if (isset($_POST['nojs']))
$points += 1;
if (preg_match("/(<.*>)/i", $_POST['comments']))
$points += 2;
if (strlen($_POST['name']) < 3)
$points += 1;
if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
$points += 2;
Is anyone able to suggest where I'm going wrong?
Do you think if I just remove parts of the code, the form would work, or have I done something else wrong?
Hoping someone can help me!