开发者

report page sending to email

Ive got a form set up where users can report posts. The page allows them to enter the message id and the choose from a number of radio buttons to which the post had breached and then submit the report

How can i get it so that once the user has entered a message id and clicked a radio button to which the post apply to and click submit, all the data is sent to an email address to where i can review from there?

Also i want it to check if a message id and atleast o开发者_运维技巧ne radio button has been clicked before submitting and if not displaying a error messages stating they must do this

Thanks


Use the mail() function (as long as your server is configured with an MTA, otherwise you'll need to use a PHP SMTP client, which is much messier).

Edit: had missed your requirement for form validation. That should really be a separate question, but while you can check in JavaScript you will need a fallback validation in PHP otherwise people can bypass your checks. So, something like:

if(count($_POST['checkboxes']) < 1) /* some error*/

should be what you need. Just be sure the checkboxes have [] on the end of the name (something like name="checkboxes[]") -- otherwise you need to do something hairy like:

if($_POST['box1'] || $_POST['box2']) ...

or

$valid = false;
foreach(array('box1', 'box2', ...) as $f) $valid = $valid || $_POST[$f];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜