Lab1.html <title>my First PHP Lab</title> <form name = "form1" method = "post" action = "lab1.php"> Please enter your Username and Email<br /> Name: <input type = "text" name = "UserName" value = " " size = "20"> <br /> Email: <input type = "text" name = "Email" value = " " size = "20"><br /> <input type = "submit" name = "button1" value = "Continue"> Lab1.php <?php $strusername = $_POST['UserName']; echo $strusername; $stremail =$_POST['Email']; echo $stremail; Lab2.html <title>lab2</title> <form method="post" action="lab2.php" name="form2"> <table style="width: 100%" border="1">
<td>name</td> <td><input type="text" name="name" size="20"></td> <td>email</td> <td><input type="text" name="email" size="20"></td> <td>gender</td> <td>male:<input type="radio" name="r1" value="male" checked="checked"></td> <td>female:<input type="radio" name="r1" value="female"> </td> <td>expert in:</td> <td>database:<input type="checkbox" name="c1" value="database"></td> <td>unix<input type="checkbox" name="c2" value="unix"></td> <td>programming:<input type="checkbox" name="c3" value="programming"></td> <input type="submit" value="submit" name="submit"> Lab2.php
<title>lab2</title> <form method="post" action="lab2.php" name="form2"> <table style="width: 100%" border="1"> <td>name</td> <td><input type="text" name="name" size="20"></td> <td>email</td> <td><input type="text" name="email" size="20"></td> <td>gender</td> <td>male:<input type="radio" name="r1" value="male" checked="checked"></td> <td>female:<input type="radio" name="r1" value="female"> </td> <td>expert in:</td> <td>database:<input type="checkbox" name="c1" value="database"></td> <td>unix<input type="checkbox" name="c2" value="unix"></td> <td>programming:<input type="checkbox" name="c3" value="programming"></td> <input type="submit" value="submit" name="submit">
VERIFY.PHP <title>confirmation</title> <?php $strlastname = $_POST["LastName"] <?php $strfirstname = $_POST["FirstName"] <?php $stremail = $_POST["Email"] <?php $strusername = $_POST["UserName"] <form method="post" action="process.php"> <h3><b><center>please Confirm Your Data Entry</center></b></h3> <p>if this information is NOT correct, please use the back button of your browser to return to the previous page and re-enter the information. Otherwise, continue.</p> <table border="1" width="100%"> <td width="50%">please enter the Last Name:</td> <td width="50%"><?php print($strlastname); </td> <td width="50%">please enter the First Name:</td> <td width="50%"><?php print($strfirstname); </td> <td width="50%">please enter the Email:</td> <td width="50%"><?php print($stremail); </td> <td width="50%">please enter the User Name:</td> <td width="50%"><?php print($strusername); </td> <td width="50%"></td> <td width="50%"><input type="submit" value="continue" name="button1"/></td>
<input type = "hidden" name = "LastName" value = "<?php print($strlastname); "> <input type = "hidden" name = "FirstName" value = "<?php print($strfirstname); "> <input type = "hidden" name = "Email" value = "<?php print($stremail); "> <input type = "hidden" name = "UserName" value = "<?php print($strusername); "> PROCESS.PHP <title>update the Database</title> <?php $strlastname = $_POST["LastName"] <?php $strfirstname = $_POST["FirstName"] <?php $stremail = $_POST["Email"] <?php $strusername = $_POST["UserName"] <?php $server = "csmaster.sxu.edu"; $username = "ab13001"; $password = "613130"; $handle = mysql_connect($server, $username, $password); $db = mysql_select_db("ab13001"); <?php $sql = "INSERT INTO lab2_students (LastName, FirstName, Email, UserName) VALUES ('$_POST[LastName]','$_POST[FirstName]','$_POST[Email]','$_POST[UserName]')"; if (!mysql_query($sql,$handle)) { die('error: '. mysql_error()); } echo "1 record added"; <form method="post" action="addperson.php"> <h3><b><center> Database Update Completed </center></b></h3>
<table border="1" width="100%"> <td width="50%">last Name:</td><td width="50%"><?php print($strlastname); </td> <td width="50%">first Name:</td><td width="50%"><?php print($strfirstname); </td> <td width="50%">email:</td><td width="50%"><?php print($stremail); </td> <td width="50%">user Name:</td><td width="50%"><?php print($strusername); </td> <td width="50%"></td> <td width="50%"><input type="submit" value="add Another Person" name="button1"/></td> <?php mysql_close($handle); LISTALL.PHP <title>database Information</title> <?php $server = "csmaster.sxu.edu"; $username = "ab13001"; $password = "613130"; $handle = mysql_connect($server, $username, $password); $db = mysql_select_db("ab13001"); <?php $strquery = "Select * from lab2_students "
<?php $rs = mysql_query($strquery) or die(mysql_error()); <?php echo "<table border='1'> <th>user Name</th> <th>first Name</th> <th>last Name</th> <th>email</th> "; <?php while($row = mysql_fetch_array($rs)) { echo ""; echo "<td>". $row['username']. "</td>"; echo "<td>". $row['firstname']. "</td>"; echo "<td>". $row['lastname']. "</td>"; echo "<td>". $row['email']. "</td>"; echo ""; } echo ""; <a href="lab3.php">lab3 Page</a> <?php mysql_close($handle); Lab3.php <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>add or View Records</title> <h3><b><center>add or View Records</center></b></h3>
<table border="1" width="100%"> <form method="post" action="addperson.php"> <td width="50%">add Person Page:</td> <td width="50%"><input type="submit" value="add Person" name="button1"/></td> <form method="post" action="listall.php"> <td width="50%">list All Records Page:</td> <td width="50%"><input type="submit" value="list All" name="button2"/></td> AddPerson.php <title>add Person to the Database</title> <form method="post" action="verify.php"> <h3><b><center>add Person to the Database</center></b></h3> <table border="1" width="100%"> <td width="50%">please enter the Last Name:</td> <td width="50%"><input type="text" name="lastname" size="20"/></td> <td width="50%">please enter the First Name:</td> <td width="50%"><input type="text" name="firstname" size="20"/></td>
<td width="50%">please enter the Email:</td> <td width="50%"><input type="text" name="email" size="20"/></td> <td width="50%">please enter the User Name:</td> <td width="50%"><input type="text" name="username" size="20"/></td> <td width="50%"></td> <td width="50%"><input type="submit" value="submit" name="button1"/></td>