Video: Lecture 2 "PHP Cont." - Building Dynamic Websites (Youtube link to open in a new window 0m ~ 44m)
Course Web Site by CS75.tv
Course Sillabus (Opens in a PDF)
Lecture Slides for Lecture 2 (Opens in a PDF)
Lecture 2 Source Codes
Lecture 2 Source Codes in PDF
Course Assignment (Project)
Summary: This is the first lecture of the series. Building Dynamic Websites by Harvard OpenCourseWare with Great Instructor David J. Malan
Each assignment is expected to take 30 to 40 hours to complete.
<?
/*************************************************************
* froshims0.php
*
* David J. Malan
* malan@harvard.edu
*
* Implements a registration form for Frosh IMs.
* Submits to register0.php.
*****************************************************************/
?>
<!DOCTYPE html>
<html>
<head>
<title>Frosh IMs</title>
</head>
<body>
<div style="text-align: center">
<h1>Register for Frosh IMs</h1>
<br><br>
<form action="register0.php" method="post">
<table style="border: 0; margin-left: auto; margin-right: auto; text-align: left">
<tr>
<td>Name:</td>
<td><input name="name" type="text"></td>
</tr>
<tr>
<td>Captain:</td>
<td><input name="captain" type="checkbox"></td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input name="gender" type="radio" value="F"> F
<input name="gender" type="radio" value="M"> M
</td>
</tr>
<tr>
<td>Dorm:</td>
<td>
<select name="dorm">
<option value=""></option>
<option value="Apley Court">Apley Court</option>
<option value="Canaday">Canaday</option>
<option value="Grays">Grays</option>
<option value="Greenough">Greenough</option>
<option value="Hollis">Hollis</option>
<option value="Holworthy">Holworthy</option>
<option value="Hurlbut">Hurlbut</option>
</select>
</td>
</tr>
</table>
<br><br>
<input type="submit" value="Register!">
</form>
</div>
</body>
</html>
Course Sillabus (Opens in a PDF)
Lecture Slides for Lecture 2 (Opens in a PDF)
Lecture 2 Source Codes
Lecture 2 Source Codes in PDF
Course Assignment (Project)
Lecture 0: HTTP |
Lecture 1: PHP |
Lecture 2: PHP, Continued |
Lecture 3: MVC, XML |
Lecture 4: SQL |
Lecture 5: SQL, Continued |
Lecture 6: JavaScript |
Lecture 7: Ajax |
Lecture 8: Security |
Lecture 9: Scalability |
Each assignment is expected to take 30 to 40 hours to complete.
<?
/*************************************************************
* froshims0.php
*
* David J. Malan
* malan@harvard.edu
*
* Implements a registration form for Frosh IMs.
* Submits to register0.php.
*****************************************************************/
?>
<!DOCTYPE html>
<html>
<head>
<title>Frosh IMs</title>
</head>
<body>
<div style="text-align: center">
<h1>Register for Frosh IMs</h1>
<br><br>
<form action="register0.php" method="post">
<table style="border: 0; margin-left: auto; margin-right: auto; text-align: left">
<tr>
<td>Name:</td>
<td><input name="name" type="text"></td>
</tr>
<tr>
<td>Captain:</td>
<td><input name="captain" type="checkbox"></td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input name="gender" type="radio" value="F"> F
<input name="gender" type="radio" value="M"> M
</td>
</tr>
<tr>
<td>Dorm:</td>
<td>
<select name="dorm">
<option value=""></option>
<option value="Apley Court">Apley Court</option>
<option value="Canaday">Canaday</option>
<option value="Grays">Grays</option>
<option value="Greenough">Greenough</option>
<option value="Hollis">Hollis</option>
<option value="Holworthy">Holworthy</option>
<option value="Hurlbut">Hurlbut</option>
</select>
</td>
</tr>
</table>
<br><br>
<input type="submit" value="Register!">
</form>
</div>
</body>
</html>
===================================
<?
/***************************************************************
* register0.php
*
* Computer Science 50
* David J. Malan
*
* Dumps contents of $_POST.
***************************************************************/
?>
<!DOCTYPE html>
<html>
<head>
<title>Frosh IMs</title>
</head>
<body>
<pre>
<? print_r($_POST); ?>
</pre>
</body>
</html>
============================================================
$_POST superglobal variable stores data in an array as follows;
Insert a test script to output the content of $_POST recursively.
<? print_r($_POST);?>
The following functions also output the content of the $_POST variable;
<? var_dump($_POST);?>
<? var_export($_POST);?>
Edit the configuration file, httpd.conf.
No comments:
Post a Comment