Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <?php
- //include "footer.php";
- //include "header.php";
- function test_input($data)
- {
- $data = trim($data);
- $data = stripslashes($data);
- $data = htmlspecialchars($data);
- return $data;
- }
- $firstName = $lastName = $telephonenumber = $email = $birthdate = $where = "";
- if ($_SERVER["REQUEST_METHOD"] == "POST")
- {
- $firstName = test_input($_POST["firstName"]);
- $lastName = test_input($_POST["lastName"]);
- $telephonenumber = test_input($_POST["telephonenumber"]);
- $email = test_input($_POST["email"]);
- $birthdate = test_input($_POST["birthdate"]);
- $radio = test_input($_POST["where"]);
- $when = test_input($_POST["when"]);
- }
- ?>
- <style>
- .split{
- width: 50%;
- top: -10px;
- padding-top: 10px;
- }
- .left {
- left: 10px;
- }
- .right {
- right: -60px;
- position: fixed;
- }
- </style>
- <div class="split left">
- <form method="post" action="input.php">
- <fieldset>
- <legend> <b>Personal Information</b> </legend>
- <p>
- <label>First Name </label><br>
- <input type="text" name="firstName" />
- </p>
- <p>
- <label>Last Name </label><br>
- <input type="text" name="lastName" />
- </p>
- <label>Telephone Number </label><br>
- <input type="number" name="telephonenumber" />
- </p>
- <label>Email </label><br>
- <input type="email" name="email" />
- </p>
- <label>Birth Date </label><br>
- <input type="date" name="birthdate" />
- </p>
- </fieldset>
- <br>
- <form method="get" action="input.php">
- <fieldset>
- <legend> <b>Profession</b> </legend>
- <input type="radio" name="where" value="Student" >Student <br/>
- <input type="radio" name="where" value="Doctor">Doctor <br/>
- <input type="radio" name="where" value="Farmer">Farmer <br/>
- <input type="radio" name="where" value="Engineer">Engineer <br/>
- </fieldset>
- <br>
- <form method="get" action="input.php">
- <fieldset>
- <legend> <b>Favorite Sports</b></legend>
- <select name="when" size ="4">
- <option value="Hockey"> Hockey </option>
- <option value="Football"> Football </option>
- <option value="Curling"> Curling </option>
- <option value="Tennis"> Tennis </option>
- </select>
- </p>
- </fieldset>
- <br>
- <input type="submit"/>
- <input type="reset"/>
- </div>
- <div class="split right">
- <?php
- echo "<br><br><br><br>";
- echo 'First name: ', $firstName;
- echo "<br>";
- echo 'Last name: ', $lastName;
- echo "<br>";
- echo 'Telephone number: ', $telephonenumber;
- echo "<br>";
- echo 'Email: ', $email;
- echo "<br>";
- echo 'Birth Date: ', $birthdate;
- echo "<br>";
- echo 'Profession: ', $radio;
- echo "<br>";
- echo 'Favorite sport: ', $when;
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement