MySQL photo

来源:互联网 发布:松下tda200编程软件 编辑:程序博客网 时间:2024/05/21 17:22
<!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=utf-8" />
<title>MySQL photo</title>
</head>
<body>
    <table align="center" width="325" border="1" cellpadding="0" cellspacing="2" bordercolor="#FFCCFF">
    <form name="form1" method="post" action="#" enctype="multipart/form-data">
    <!--enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码。enctype="multipart/form-data"不对字符编码。在使用包含文件上传控件的表单时,必须使用该值。-->
        <tr align="center">
            <td align="center" height="25" colspan="2">MySQL photo </td>
        </tr>
        <tr>
            <td width="100" align="center">textarea</td>
            <td width="345" align="center"><textarea name="textarea" cols="25" rows="3" wrap="virtual"></textarea></td>
        <!--wrap="virtual" 将实现文本区内的自动换行,以改善对用户的显示,但在传输给服务器时,文本只在用户按下 Enter 键的地方进行换行,其他地方没有换行的效果。-->
        </tr>
        <tr>
            <td height="53" align="center">photo</td>
            <td valign="middle" align="center">
           <!-- 数据库图片相对路径:images\a12.png-->
            <?php
                $link=mysql_connect("localhost","root","a3141592654")or die("数据库服务器连接失败!".mysql_error());
                mysql_select_db("msphp",$link)or die("数据库连接失败!".mysql_error());
                mysql_query("set names utf-8");
                $sql=mysql_query("select src from tb_images;");
                while($info=mysql_fetch_array($sql)){
            ?>
            <label>
            <input type="radio" name="radio" value="<?php echo $info['src'];  ?>" />
            <img src="<?php echo $info['src']; ?>" width="19" height="19" /><!--src文件路径-->
            </label>
            <?php } ?>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
            <input type="submit" name="submit" value="提交" />
            </td>
        </tr>
    </form>
    </table>
    <?php
        if($_POST['submit']=='提交'){
            $radio=$_POST['radio'];
            $textarea=$_POST['textarea'];
        }
    ?>
    <table align="center" border="1" width="325" cellpadding="0" cellspacing="2" bordercolor="#FFCCFF">
        <tr align="center">
            <td align="center" height="25">photo </td>
            <td width="215" height="25" align="center">textarea</td>
        </tr>
        <tr>
            <td align="center" height="25">
            <img src="<?php echo $radio; ?>" width="19" height="19" />
            </td>
            <td align="center"><?php echo $textarea; ?>
            </td>
        </tr>
    </table>
</body>
</html>
原创粉丝点击