PHP空白页面提交

时间:2016-05-19 17:32:25

标签: php html process web notepad++

我在看This Page并决定尝试一下。我正在建立一个允许用户有效检查手机的网站。我唯一的问题是,就像原问题的提问者一样,我得到一个空白的屏幕。我选择了最佳答案来尝试我的。

add.html

    <form action="add_process.php" method="POST">
        <h3>Phone Model</h3>
        <input name="model" type="text" />
        <h3>ESN/MEID</h3>
        <input name="esn" type="text" />
<br>
        <br>
                <input type="checkbox" name="wifi">WiFi<br><br>
                <input type="checkbox" name="data">Cellular Data<br><br>
                <input type="checkbox" name="call">Calling<br><br>
                <input type="checkbox" name="text">Texting<br><br>
                <input type="checkbox" name="espaeker">Ear Speaker<br><br>
                <input type="checkbox" name="rspeaker">Rear Speaker<br><br>
                <input type="checkbox" name="tmic">Top Mic<br><br>
                <input type="checkbox" name="bmic">Bottom Mic<br><br>
                <input type="checkbox" name="cport">Chargeing Port<br><br>
                <input type="checkbox" name="hport">Headphone Port<br><br>
                <input type="checkbox" name="touch">Touch Screen<br><br>
                <input type="checkbox" name="updates">System Updates<br><br>
                <input type="checkbox" name="battery">Battery<br><br>
                <input type="checkbox" name="fcamera">Forward Facing Camera<br><br>
                <input type="checkbox" name="rcamera">Rear Facing Camera<br><br>
                <input type="checkbox" name="bluetooth">Bluetooth<br><br>
                <input type="checkbox" name="lcd">LCD<br><br>
                <input type="checkbox" name="gsm">GSM Unlocked<br><br>
                <input type="checkbox" name="buttons">Buttons<br><br>
                <input type="checkbox" name="flash">Flash<br><br>
                <input type="checkbox" name="vibrator">Vibrator<br><br>
                <input type="text" cols="50" rows="10"  name="cosmetics">Cosmetic Comment<br><br>
        <input type="text" name="comments">Comments<br><br>
        <input type="submit" name="submit" value="Save Data">
    </form>

add_process.php

<?php
if (isset($_POST['model']) && isset($_POST['esn']) && isset($_POST['wifi']) && isset($_POST['data']) && isset($_POST['call']) && isset($_POST['text']) && isset($_POST['espeaker']) && isset($_POST['rspeaker']) && isset($_POST['tmic']) && isset($_POST['bmic']) && isset($_POST['cport']) && isset($_POST['hport']) && isset($_POST['touch']) && isset($_POST['updates']) && isset($_POST['battery']) && isset($_POST['facmera']) && isset($_POST['rcamera']) && isset($_POST['bluetooth']) && isset($_POST['lcd']) && isset($_POST['gsm']) && isset($_POST['buttons']) && isset($_POST['flash']) && isset($_POST['vibrator']) && isset($_POST['cosmetics']) && isset($_POST['comments'])) { // check if both fields are set

    $data = $_POST['field1'] . '-' . $_POST['field2'] . "\n";
    $ret = file_put_contents('/tmp/mydata.txt', $data, FILE_APPEND | LOCK_EX);
    if($ret === false) {
        die('There was an error writing this file');
    }
    else {
        echo "$ret bytes written to file";
    }
}
else {
   die('no post data to process');
}

0 个答案:

没有答案