Php高级表单

Php高级表单,php,mysql,phpmyadmin,content-management-system,Php,Mysql,Phpmyadmin,Content Management System,我正在从事CMS项目,处理表单,将信息添加到mysql中。一切都很好,但“文本区”似乎太简单了,即使使用tinymce。我正在寻找任何有助于改善“texarea”的建议,例如添加多个图像(我的只允许一个) 谢谢你,请放弃我糟糕的英语 这是我的密码: <script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script> <script>tinymce.init({ select

我正在从事CMS项目,处理表单,将信息添加到mysql中。一切都很好,但“文本区”似乎太简单了,即使使用tinymce。我正在寻找任何有助于改善“texarea”的建议,例如添加多个图像(我的只允许一个)

谢谢你,请放弃我糟糕的英语 这是我的密码:

    <script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>
  <script>tinymce.init({ selector:'textarea' });</script>

<form method="post" action="insert_post.php" enctype="multipart/form-data">

    <table width="800" align="center" border="10">

        <tr>
            <td align="center" bgcolor="yellow" colspan="6"><h1>Insert New Post Here</h1></td>
        </tr>

        <tr>
            <td align="right">Post Title:</td>
            <td><input type="text" name="post_title" size="30"></td>
        </tr>
        <tr>
            <td align="right" bgcolor="#FF6600"><strong>Post Category:</strong></td>
            <td>
            <select name="cat">
                <option>Select a Category</option>
                <?php
                include("includes/connect.php");
                $get_cats = "select * from catelogries";
                $run_cats = mysql_query($get_cats);
                while ($cats_row=mysql_fetch_array($run_cats)){
                    $cat_id=$cats_row['cat_id'];
                    $cat_title=$cats_row['cat_title'];
                    echo "<option value='$cat_id'>$cat_title</option>";
                }
                ?>
                </select>
                </td>

        </tr>
        <tr>
            <td align="right">Post Author:</td>
            <td><input type="text" name="post_author" size="30"></td>
        </tr>

        <tr>
            <td align="right">Post Keywords:</td>
            <td><input type="text" name="post_keywords" size="30"></td>
        </tr>

        <tr>
            <td align="right">Post Image:</td>
            <td><input type="file" name="post_image"></td>
        </tr>

        <tr>
            <td align="right">Post Content:</td>
            <td><textarea name="post_content" cols="30" rows="15"></textarea></td>
        </tr>

        <tr>
            <td align="center" colspan="6"><input type="submit"  name="submit" value="Publish Now"></td>
        </tr>


    </table>
<?php 


if(isset($_POST['submit'])){

    $post_title = $_POST['post_title'];
    $post_date = date('m-d-y');
    $post_cat = $_POST['cat'];
    $post_author = $_POST['post_author'];
    $post_keywords = $_POST['post_keywords'];
    $post_content = $_POST['post_content'];
    $post_image= $_FILES['post_image']['name'];
    $post_image_tmp= $_FILES['post_image']['tmp_name'];

    if( $post_title=='' or $post_cat=='null' or 
        $post_author=='' or $post_keywords=='' or 
        $post_content=='' or $post_image=='')
    {
        echo "<script>alert('Any of the fields is empty')</script>";
        exit();
    } else {

        move_uploaded_file($post_image_tmp,"../images/$post_image");

        $insert_posts = "insert into posts 
                            (category_id,post_title,post_date,
                            post_author,post_image,post_keywords,
                            post_content) 
                        values ('$post_cat','$post_title','$post_date',
                                '$post_author','$post_image','$post_keywords',
                                '$post_content')";

        mysql_query($insert_posts);

        echo "<script>alert('post published successfuly')</script>";
        exit();
    }
}
?>

init({选择器:'textarea'});
在此插入新帖子
职位名称:
帖子类别:
选择一个类别

当然了!每次在新代码中使用数据库扩展时,它都会被弃用,并且已经存在多年,在PHP7中永远消失。如果你只是在学习PHP,那么就把精力花在学习
PDO
mysqli
数据库扩展和准备好的语句上。