PHP电子邮件 - 没有检测到变量?

时间:2014-10-14 21:32:43

标签: php html email variables

好的 - 我最近购买了一个模板并且对PHP有了很好的理解。

我得到的问题是PHP变量没有被检测到(或者是空白的),即使我已经明确宣布它们,我已经在这个问题上失去了智慧。

在transferConfirm.php中

$name = $_POST['name'];
$cid = $_POST['cid'];
$clink = $_POST['clink'];
$mviews = $_POST['mviews'];
$subs = $_POST['subs'];
$cnetwork = $_POST['cnetwork'];
$nnetwork = $_POST['nnetwork'];

在transfer.php中

            <section id="contact-form">
            <div class="container">
                <div class="col-lg-12 section-title-price wow flipInX">
                    <h2><small>Partner Transfer</small></h2>
                    <p class="lead"><span class="highlight">Learn More About Network Transfers</span></p>
                </div>
                <div class="col-lg-12 text-center wow flipInX" id="contact">
                    <div id="message"></div>
                    <form method="post" action="transferConfirm.php" name="contactform" id="contactform">
                    <fieldset>
                    <div class="col-md-6"> 
                    <p><strong>Channel Information</strong></p>
                        <input name="name" type="text" id="name" size="30" placeholder="Full Name"/>
                        <br />
                        <input name="cid" type="text" id="cid" placeholder="Customer ID"/>
                        <br />
                        <input name="clink" type="text" id="email" placeholder="Channel Link"/>
                        <br /> 
                        <input name="mviews" type="text" id="mviews" placeholder="Monthly Views"/>
                        <br />
                        <input name="subs" type="text" id="subs" placeholder="Subscribers"/>

                    </div>
                    <div class="col-md-6"> 
                    <p><strong>Network Information</strong></p>
                        <input name="cnetwork" type="text" id="cnetwork" placeholder="Current Network Name"/>
                        <br />
                        <input name="nnetwork" type="text" id="nnetwork" placeholder="New Network Name"/>
                    </div>
                    <div class="col-md-12 text-center">
                        <input type="submit" class="submit" id="submit" value="Submit Transfer" />
                    </div>
                    </fieldset>
                    </form>
                </div>
            </div>
        </section>

我知道一些代码在HTML中可能看起来很笨拙 - 但我不能看出它是错误的原因。但是,$ name变量似乎是唯一有效的?!

发生错误的地方:

    echo "<fieldset>";
echo "<div id='success_page'>";
echo "<h4 class='highlight'>Thank you <strong>$name</strong>, your messaged has been submitted to us.</h4>";
echo "<h4 class='highlight'>Thank you <strong>$cid</strong>, your message has been submitted to us.</h4>";
echo "</div>";
echo "</fieldset>";

$ name似乎正在运作,但$ cid isn&#t; t?!

1 个答案:

答案 0 :(得分:0)

表单提交 transferConfirm.php ,而不是 confirmTransfer.php 。尝试更改文件名或表单提交操作。