PHP write to email problem [closed]
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this questionI have the following script which creates an email from a contact form: http://codeviewer.org/view/code:1b54
I am having trouble getting the contents of the 'heard' drop down list (line 49) to output to the email.
I can successfully output the selected value on line 99 but when i try to add it to the email on line 131 nothing appears. I get the Heard: but not the actual value.
Any suggestions?
Thanks!
If I understood correctly - $heard is a global variable that is defined on line 88 so it is not avaliable inside a function. Change
global $to, $extra;
to
global $to, $extra, $heard;
this should help.
Upd: I think you should read about variable scopes in PHP: http://php.net/manual/en/language.variables.scope.php .
精彩评论