Form - Name in subject header


#1

I have a functional form that mails into our Help Desk system to notify the admins of new users. I want to add the new user’s name into the subject. I’m very new to PHP, so please be patient.

Here are the two fields that pick up the First and Last name:

[code]new_line_check($_POST[‘Users First Name’]);

// Check for disallowed characters

$disallowed_name = array(’:’,’;’,’"’,’=’,’(’,’)’,’{’,’}’,’@’);

foreach($disallowed_name as $value)
{

if(stristr($_POST[‘Users First Name’],$value)){header(“location: $_SERVER[HTTP_REFERER]”);exit;}

}

new_line_check($_POST[‘Users Last Name’]);

// Check for disallowed characters

$disallowed_name = array(’:’,’;’,’"’,’=’,’(’,’)’,’{’,’}’,’@’);

foreach($disallowed_name as $value)
{

if(stristr($_POST[‘Users Last Name’],$value)){header(“location: $_SERVER[HTTP_REFERER]”);exit;}

}[/code]

Here is the subject line:

$subject = "UAR Form -"

I tried adding {$_POST['Users First Name']} {$_POST['Users Last Name']};

in the subject’s quotes but it did not work. I think I’m missing something.[/code]


#2

Someone else tell me if I’m wrong, but I don’t think you can have spaces in variables like Users First Name. You need to have $_POST[‘Users_Frist_Name’]. Try that out and see if you get the expected results you seek.


#3

I’ll give it a try after I’m done tweaking the server a bit. I have spaces in the form and they print out in the email with underscores, so I don’t know.