09 PHP Forms
09 PHP Forms
CS380
Web Data
2
data
Most server-side web programs accept
CS380
parameters that guide their execution
Reading/writing an entire file
3
URL?name=value&name=value...
http://example.com/student_login.php?username=xenia&sid=12
34567
CS380
HTML forms
4
form: a group of UI
controls that
accepts information
from the user and
sends the
information to a
web server
the information is
sent to the server
as a query string
CS380
HTML form: <form>
5
CS380
Form example
6
<form action="http://www.google.com/search">
<div>
Let's search Google:
<input name="q" />
<input type="submit" />
</div>
</form>
HTML
First Paragraph
CS380
7 Form controls
CS380
Form controls: <input>
8
CS380
Text fields: <input>
10
field
maxlength limits how many characters user is
CS380
able to type into field
Text boxes: <textarea>
11
CS380
Radio buttons: <input>
13
CS380
Text labels: <label>
14
<select name="favoritecharacter">
<optgroup label="Major Characters">
<option>Frodo</option>
<option>Sam</option>
<option>Gandalf</option>
<option>Aragorn</option>
</optgroup>
<optgroup label="Minor Characters">
<option>Galandriel</option>
<option>Bilbo</option>
</optgroup>
</select>
HTML