Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="validate.php" method="post">
- <p>Username: </p><input type="text" name="username" value="" /><br />
- <p>Password: </p><input type="password" name="password" value="" /><br />
- <br />
- <input type="submit" name="submit" value="submit" /><br />
- </form>
- <pre>
- <?php
- print_r($_POST);
- ?>
- </pre>
- <?php
- // Uses ternary operator
- $username = isset($_POST["username"]) ? $_POST["username"] : NULL;
- $password = isset($_POST["password"]) ? $_POST["password"] : NULL;
- ?>
- if (isset($_POST["username])) {
- $username = $_POST["username"];
- } else {
- $username = "";
- }
- if (isset($_POST["password"])) {
- $password = $_POST["password"];
- } else {
- $password = "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement