开发者

Basic form to email php code not working

From my html page.

<form method="POST" action="sm.php">
    <p>Login</p><br />
    Username: <input type="text" size="10" maxlength="50" name="un"> <br />
    Password: <input type="text" size="10" maxlength="50" name="ps"><br />
    <INPUT type="submit" value="Submit" name = "submit">
    </form> 

From my php page.

<?php
  $to = "xxxxxx@xxx.com";
  $subject = "Good sir!";
  $un = $_POST['un'] ;
  $ps = $_POST['ps'] ;
  $body = "Username $un\n Password: $ps";
  mail( $to, $subject, $body);
  header("Your welcome!");
?>

It's a very simple concept I know but for some reason it isn't working. At first I just did it from my computer and it wasn't working so I figure I would put it on a server that supported PHP开发者_StackOverflow社区 and I did and still it's not working correctly. Am I missing something?

David.


PHP May need to be configured to send email. If you have access to your server's php.ini file you can check the settings in there. Or you can use the php_info() function ( http://php.net/php_info ) to dump the settings to HTML (make sure you don't leave a file accessible on the server with that information publicly available.)

The setting you are probably needing to alter is "sendmail_path" on Linux. See this page for other mail settings... http://php.net/manual/en/mail.configuration.php#ini.sendmail-path

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜