制作一个注册网页(1)

下面用html+php制作一个最简单的注册网页:

<!DOCTYPE HTML>
<html>
    <head>
        <title>hello, word</title>
    </head>
    <body bgcolor = #ffcc00>
        <div style = 'background-color:rgb(100,0,255);text-align:center'>
            <h1>welcome to my world</h1>
            <form action = 'register.php' method = 'post'>
                <table style = 'border = 0;margin-left:auto;margin-right:auto;text-align:left'>
                    <tr>
                        <td><h2>Name:</h2></td>
                        <td><input name = 'name' type = 'text'></td>
                    </tr>
                    <tr>
                        <td><h2>Captain:</h2></td>
                        <td><input name = 'captain' type = 'checkbox'></td>
                    </tr>
                    <tr>
                        <td><h2>Gender:</h2></td>
                        <td><input name = 'gender' type = 'radio' value = 'F'>F<input name = 'gender' type = 'radio' value = 'M'>M</td>
                    </tr>
                    <tr>
                        <td><h2>Dorm:</h2></td>
                        <td>
                            <select name = 'dorm' size = 1>
                            <option value = ''></option>
                            <option value = 'undergraduate 1'>undergraduate 1</option>
                            <option value = 'undergraduate 2'>undergraduate 2</option>
                            <option value = 'undergraduate 3'>undergraduate 3</option>
                            <option value = 'undergraduate 4'>undergraduate 4</option>
                            <option value = 'undergraduate 5'>undergraduate 5</option>
                        </td>
                    </tr>
                </table>
                <br>
                <input type = 'submit' value = 'Register'>
            </form>
        </div>
    </body>
</html>

下面是处理注册信息的:

<?php if(@$_POST['name'] == ''||@$_POST['captain']==''||@$_POST['gender']==''||@$_POST['dorm']=='') { print('You must complete all the information rquired,otherwise you can go die\n'); print_r(@$_POST); exit; } ?>

<!DOCTYPE HTMLE>
<html>
    <h1>your registratioin has been submitted successfully! Please wait for the result patiently</h1>
</html>

制作一个注册网页(1)_第1张图片

你可能感兴趣的:(制作一个注册网页(1))