Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.php #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
<?php

?>
<?php
session_start();
?>
<html>
<head>
<title>Enter Form Data</title>
<style>
label{
display: inline-block;
width: 20em;
}
.error{
border: 3px solid red;
}
</style>
</head>
<body>
<h1>Enter Form Data</h1>
<!--
the $_SESSION variable is an associative array
then in this case each element of that array is its an associative array
having two properties -- one for the value and one if it's valid (true or false)
if what was entered is not valid add the error class
-->
<form action="handler.php" method="post" name="frmInfo">
<label for="txtID">La Salle ID:</label><input type="text" name="txtID"
value="<?php if(isset($_SESSION['txtID'])){echo $_SESSION['txtID']['value'];} ?>"
<?php if(isset($_SESSION['txtID']) && !$_SESSION['txtID']['valid']){echo "class='error'";} ?>
/><br />

<label for="txtUName">Username:</label><input type="text" name="txtUName"
value="<?php if(isset($_SESSION['txtUName'])){echo $_SESSION['txtUName']['value'];} ?>"
<?php if(isset($_SESSION['txtUName']) && !$_SESSION['txtUName']['valid']){echo "class='error'";} ?>
/><br />

<label for="txtCourse">Course:</label><input type="text" name="txtCourse"
value="<?php if(isset($_SESSION['txtCourse'])){echo $_SESSION['txtCourse']['value'];} ?>"
<?php if(isset($_SESSION['txtCourse']) && !$_SESSION['txtCourse']['valid']){echo "class='error'";} ?>
/><br />

<label for="txtRL">Room Location:</label><input type="text" name="txtRL"
value="<?php if(isset($_SESSION['txtRL'])){echo $_SESSION['txtRL']['value'];} ?>"
<?php if(isset($_SESSION['txtRL']) && !$_SESSION['txtRL']['valid']){echo "class='error'";} ?>
/><br />

<input type="submit" value="Submit" />
</form>
</body>
</html>