<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>PHP语言基础</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <tr bgcolor="#FFCC33"> <td>图像域:</td> <td> <input type="image" src="https://www.jb51.net/btn__details_praise_selected.png"> </td> </tr> </form> <?php header("Content-Type:text/html; charset=gb2312"); ?> </body> </html>
运行效果:
图像域是指可以用在提交按钮位置上的图片,这副图片具有按钮的功能
5、radio
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>PHP语言基础</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <tr bgcolor="#FFCC33"> <td>单选按钮:</td> <td> <input type="radio" value="1" checked>男 <input type="radio" value="0" >女 </td> </tr> </form> <?php header("Content-Type:text/html; charset=gb2312"); ?> </body> </html>
运行结果:
单选按钮,用于设置一组选择项,用户只能选择一项。checked属性用来设置该单选按钮默认被选中。
6、checkbox
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>PHP语言基础</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <tr bgcolor="#FFCC33"> <td>复选框:</td> <td> <input type="checkbox" value="1" checked>苹果 <input type="checkbox" value="1" checked>小米 <input type="checkbox" value="1" >三星 </td> </tr> </form> <?php header("Content-Type:text/html; charset=gb2312"); ?> </body> </html>
运行结果:
复选框,允许用户选择多个选择项。checked属性用来设置该复选框默认被选中。
7、submit
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>PHP语言基础</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <tr bgcolor="#FFCC33"> <td>提交按钮:</td> <td> <input type="submit" value="提交"> </td> </tr> </form> <?php header("Content-Type:text/html; charset=gb2312"); ?> </body> </html>
运行结果:
将表单的内容提交到服务器端
8、reset
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>PHP语言基础</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <tr bgcolor="#FFCC33"> <td>重置按钮:</td> <td> <input type="reset" value="重置"> </td> </tr> </form> <?php header("Content-Type:text/html; charset=gb2312"); ?> </body> </html>
运行结果:
清除与重置表单内容,用于清除表单中所有文本框的内容,并使选择菜单项恢复到初始值。
9、button