How To Do Everything With Microsoft Expression Web
Home
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Contact
This chapter is about PHP
The code below shows how to user server variables.
The code below shows how to use forms.
Code for the PHP used in the previous example (two files are in this listing)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Enter Width and Height</title> </head> <body> <form action="CalcWidthHeight.php" method="post"> Please enter the width and height of a rectangle. <table> <tr><td align="right">Width: </td><td><input type="text" name="width" /></td></tr> <tr><td align="right">Height: </td><td><input type="text" name="height" /></td></tr> <tr><td colspan="2" align="center"><input type="submit" value="Calculate" /></td></tr> </table> </form> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Calculate Area and Perimeter</title> </head> <body> The area of the rectangle is <?php echo ((int)$_POST['width']*(int)$_POST['height']) ?><br /> The perimeter of the rectangle is <?php echo ((int)$_POST['width']*2+(int)$_POST['height']*2) ?><br /> <br /> <a href="EnterWidthHeight.php">Try it Again</a> </body> </html>
This PHP script shows the weather