how to NOT include a form field in generated email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
horev
Forum Newbie
Posts: 2
Joined: Fri Mar 18, 2011 9:16 am

how to NOT include a form field in generated email

Post by horev »

hi,
very new to php and trying to get a grip on its power.
i have a successful registration form on my html page, which on submit triggers the php file.
the file generates 2 emails - the first one to the office ( giving all the registration information) and the second
to the person who registered/submitted the form.

i don't want the person who registered to recieve ALL the info filled in. i want to omit specific fields.
i know my php code checks for all filled in ( not empty ) fields, and returns them. so how do i get this code to NOT return certain
fields? ( for example, to not return a field with name='ccinfo' and id='ccinfo' )

this is the chunk of code so far:

Code: Select all

function build_message2($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

$message2 = build_message2($_REQUEST);

$message2 = $message2 . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";

$message2 = "Thank you for registering. Below is the information you provided. \n If there are any errors, please let us know.\n\n\n NAME: ".stripslashes($message2);


$subject2 = "Your  Registration Confirmation 2";

$headers2 = "From: office@myOrg.org" ;

mail($_REQUEST['email'],$subject2,$message2,$headers2);
thank you.
gully_mi_seh
Forum Newbie
Posts: 14
Joined: Fri Mar 18, 2011 8:48 pm

Re: how to NOT include a form field in generated email

Post by gully_mi_seh »

you can set a privilege constant like : define(READABLE,1);
then you can manage what will be readable by the user by using a conditional expression like : if(READABLE){//access to read the field }
horev
Forum Newbie
Posts: 2
Joined: Fri Mar 18, 2011 9:16 am

Re: how to NOT include a form field in generated email

Post by horev »

thank you for the response. i am trying to understand it and how to actually integrate it into my code. it might be beyond my comprehension at this point.....
Post Reply