Jump to content
Larry Ullman's Book Forums

Recommended Posts

In this lesson, Larry uses an elegant solution to populate the scrubbed array:

 

$scrubbed= array_map ('spam_scrubber', $_POST);

 

I thought I'd try a more traditional route just to see if I could and I'm having difficulty. Can anyone correct this logic for me?

 

 

if ($_SERVER['REQUEST_METHOD'] == 'POST')

//$scrubbed= array_map ('spam_scrubber', $_POST);

{$scrubbed= array();

foreach ($_POST as $v)

$scrubbed= spam_scrubber($v);

 

if (!empty($scrubbed['name']) && !empty($scrubbed['email']) && !empty($scrubbed['comments']))

{$body= "Name: {$scrubbed['name']}\n\nComments:{$scrubbed['comments']}";

$body= wordwrap($body, 70);

mail('postoffice@cjbergin.com', 'Contact Form Submission', $body);

print "<p><em>Thank-you for contacting me. </em></p>";

$_POST= array();}

else

print "<p><b>Please fill out the form completely!</b></p>";}

 

 

all the other sections of the script work according to plan. The output I'm receiving is just one character per field:

 

Name: s

 

Comments:s

Link to comment
Share on other sites

 Share

×
×
  • Create New...