【问题标题】:Making contact me form [closed]联系我表格[关闭]
【发布时间】:2014-07-04 05:10:36
【问题描述】:

我正在制作一个网页,我也想联系我。我下载了一个模板,其中包含“名称”、“电子邮件”、“消息”和“发送”按钮。我已经阅读了一些指南,但从未发送过表单。

你能帮帮我吗?谢谢!

我的代码:

  • 【问题讨论】:

    • 分享你尝试过的代码
    • 你能告诉我你编写或尝试过的代码吗
    • 在此处显示您的模板代码

    标签: php forms email


    【解决方案1】:

    让我在这个级别上帮助你。

    假设你的联系页面是这样的

    <title>Contact Form</title>
    <table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr>
    <td><strong>Contact Form </strong></td>
    </tr>
    </table>
    <table width="200" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
    <td><form name="form1" method="post" action="contact_ac.php">
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
    <tr>
    <td>Name</td>
    <td>:</td>
    <td><input name="name" type="text" id="name" size="50"></td>
    </tr>
    <tr>
    <td>Email</td>
    <td>:</td>
    <td><input name="cmail" type="text" size="50"></td>
    </tr>
    <tr>
    <td width="16%">Subject</td>
    <td width="2%">:</td>
    <td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
    </tr>
    <tr>
    <td>Detail</td>
    <td>:</td>
    <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
    </tr>
    </table>
    </form>
    </td>
    </tr>
    </table>
    

    联系页面的操作

    <?php
    $name=$_POST['name'];
    $cmail=$_POST['cmail'];
    $subject=$_POST['subject'];
    $header="from: $name <$cmail";
    $to ='yourmail@yourdomain.com';
    $send_contact=mail($to,$subject,$message,$header);
    if($send_contact){
    echo "We've recived your contact information";
    }
    else {
        echo "Error Sending Mail";
        }
    ?>
    

    注意:将$to ='yourmail@yourdomain.com'; 替换为您的电子邮件。

    【讨论】:

    • 谢谢!我会给你 1,但我还没有任何声誉,对不起:(
    • 谢谢你,很高兴帮助你:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-13
    • 2018-11-14
    相关资源
    最近更新 更多