PHP Form Processing: An Example using HTML, Checkboxes, Radio Buttons, and Sessions, Study notes of Computer Science

An example of an html form that calls a php program to process user input, including first and last names, a password, a number, checkboxes, and radio buttons. The php program uses sessions to maintain state between requests and displays the form data and session information.

Typology: Study notes

Pre 2010

Uploaded on 03/10/2009

koofers-user-qoj
koofers-user-qoj 🇺🇸

5

(1)

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
416-22.1
Example of an html form that calls a php program
phpEx.html
<html>
<head>
<title>Simple php example</title>
</head>
<body>
<h1>Fill in this form</h1>
<form action="reply.php" method="post">
Enter your first name: <input type="text" name="fname" size="25" />
<br />
Enter your last name:
<input type="text" name="lname" size="25" />
<br />
Password:
<input type="password" name="pw" size="25" /> <br />
Enter a number:
<input type="text" name="numb" size="10" />
<br />
Box 1:<input type="checkbox" name="box1" value="b1" />
Box 2:<input type="checkbox" name="box2" value="b2" />
Box 3:<input type="checkbox" name="box3" value="b3" checked="checked" />
<br />
Radio 1<input type="radio" name="r1" value="r1" />
Radio 2<input type="radio" name="r1" value="r2" />
Radio 3<input type="radio" name="r1" value="r3" />
Radio 4<input type="radio" name="r1" value="r4" checked />
<br />
<input type="submit" value="Submit it!" />
<input type="reset" value="Start over" />
</form>
<hr />
<form action="killsession.php" method="post">
<input type="submit" value="Kill the session" />
</form>
</body>
</html>
killsession.php
<! killsession.php -->
<?php
session_start();
?>
<html><head><title>Kill the session</title></head>
<body>
<?php
session_destroy();
?>
pf3
pf4

Partial preview of the text

Download PHP Form Processing: An Example using HTML, Checkboxes, Radio Buttons, and Sessions and more Study notes Computer Science in PDF only on Docsity!

Example of an html form that calls a php program

phpEx.html

Simple php example

Fill in this form

Enter your first name:
Enter your last name:


Password:
Enter a number:


Box 1: Box 2: Box 3:
Radio 1 Radio 2 Radio 3 Radio 4

killsession.php

Kill the session

Session killer

That is all!