Learning PHP and MySQL

Chapter 10 Code

Friday, August 18, 2006

Figure 10-03 Text boxes

<form>
<
input  type="text"  name="search"  size="10"  maxlength="30"  />
</
form>

This creates the Figure 10-03 in the Learning PHP & MySQL book.

Posted by krautgrrl on 08/18 at 10:56 AM
Chapter 10 Code • (0) Comments • (1204) TrackbacksPermalink

Figure 10-04 A simple form with a text area element

<form>
<
label>Suggestion:  <textarea  name="suggestions"  cols="40"  rows="5"></textarea>
</
label>
<
input  type="submit"  value="Go!  />
</form>

This creates the example in Figure 10-04 in the book.

Posted by krautgrrl on 08/18 at 10:58 AM
Chapter 10 Code • (0) Comments • (0) TrackbacksPermalink

Figure 10-05 Checkboxes

<form>
<
fieldset>
<
label>Italian  <input  type="checkbox"  name="food[]"  value="Italian"  /></label>
<
label>Mexican  <input  type="checkbox"  name="food[]"  value="Mexican"  /></label>
<
label>Chinese  <input  type="checkbox"  name="food[]"  value="Chinese"
checked="checked"  /></label>
</
fieldset>
<
input  type="submit"  value="Go!  />
</form>

This code displays Figure 10-05 in the book.

Posted by krautgrrl on 08/18 at 10:59 AM
Chapter 10 Code • (0) Comments • (0) TrackbacksPermalink

Figure 10-06 Radio buttons

<form>
<
fieldset>
<
label>Italian  <input  type="radio"  name="food"  value="Italian"  /></label>
<
label>Mexican  <input  type="radio"  name="food"  value="Mexican"  /></label>
<
label>Chinese  <input  type="radio"  name="food"  value="Chinese"
checked="checked"    /></label>
</
fieldset>
<
input  type="submit"  value="Go!  />
</form>

This code generates the example in Figure 10-06 in the book.

Posted by krautgrrl on 08/18 at 11:00 AM
Chapter 10 Code • (12) Comments • (0) TrackbacksPermalink

Figure 10-09 Selecting Italian and Chinese

<html>
<
head>
   <
title>Using  Default  Checkbox  Values</title>
</
head>
<
body>
<?
php
$food
=$_GET[food];
$self=$_SERVER['PHP_SELF'];
if  (!empty(
$food))
{
   
echo  "The  foods  selected  are:<br  />";
   foreach(
$_GET[food]  as  $foodstuf)
   
{

      }
   }
else
{
   
echo  ("<form  action=\"$self\"  ");
   echo  (
'method="get">
   <fieldset>
     <label>Italian  <input  type="checkbox"  name="food[]"  value="Italian"  /></label>
     <label>Mexican  <input  type="checkbox"  name="food[]"  value="Mexican"  /></label>     
     <label>Chinese  <input  type="checkbox"  name="food[]"  value="Chinese"
checked="checked"  /></label>
     </fieldset>
       <input  type="submit"  value="Go!"  >
             '
);
}
?>
</body>
</html>

This code displays the graphic Figure 10-09 in the book.

Posted by krautgrrl on 08/18 at 11:03 AM
Chapter 10 Code • (19) Comments • (4) TrackbacksPermalink
Page 2 of 2 pages  <  1 2

Statistics

This page has been viewed 375176 times
Page rendered in 0.1705 seconds
Total Entries: 224
Total Comments: 16
Total Trackbacks: 307338
Most Recent Entry: 09/27/2006 12:39 pm
Most Recent Comment on: 10/26/2007 10:00 am
Total Members: 2
Total Logged in members: 0
Total guests: 8
Total anonymous users: 0
Most Recent Visitor on: 02/10/2012 09:11 am
The most visitors ever was 1103 on 11/20/2007 12:50 pm

Referrers

Powered by ExpressionEngine