php-初学PHP,这段测试代码的初始化错在哪儿?怎么改?

WBOY
发布: 2016-06-02 11:32:03
原创
977 人浏览过

phphtml

<code><?php $number_to_guess = 42;    $num_tries = (isset($_POST['num_tries']))? $num_tries+1:1;    if(!isset($_POST['guess']))        $message = "Welcome to the guessing machine!";    elseif(!is_numeric($_POST['guess']))        $message = "Not a num!";    else if($_POST['guess'] == $number_to_guess)        $message = "Well Done!";    else if($_POST['guess'] > $number_to_guess)        $message = $_POST['guess']." is too big, Try a smaller one!";    else if($_POST['guess']             <title>A HTML/PHP that calls itself!</title>            <h1>        <?php echo "Guessing Result:<br/>\"".$message."\"";        ?>    </h1>    <p><strong>Guess number:</strong>    <?php echo $num_tries;    ?>    </p>    <form method="post" action="<?php%20%20%20%20%20%20%20%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20%20%20%20?>%20%20%20%20">        <p><label for="guess">Type your guess here:</label><br>        <input type="text" id="guess" name="guess"></p>        <input type="hidden" name="num_tries" value="        <?php            echo $num_tries;        ?>">        <button type="submit" name="submit" value="send">Guess it!</button>    </form>      </code>
登录后复制

图片说明

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板