Edit interface 04

Click the edit button to enter the editing interface 04 new_ed.php

code show as below:

<html>

<head>
    <style>
        body {
            background-color: rgba(128, 128, 128, 0.3);
        }
    </ style > 
    < script > 
        function foo () {
             if (myform. title . value == "" ) {
                 alert ( 'Please fill in your news title' );
                myform.title.focus();
                return false;
            }
            if (myform. content . value == "" ) {
                 alert ( 'The news content cannot be empty' );
                myform.content.focus();
                return false;
            }
        }
    </script>
</head>
<body>


<?php
 /**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/18
 * Time: 18:18
 * This is used to modify the news page
 * Query the news information from the list page
 */
 header( "Content-type: text/html; charset=utf-8" ); //Set encoding
 $conn = mysqli_connect( "localhost" , "root" , "root" ) or die ( "Database connection failed" );
 $id = $_GET [ 'id' ];
 mysqli_set_charset( $conn , "utf8" );
if ($conn) {


   // mysqli_select_db($conn,'mynews') or die("指定的数据库不能打开");

    $sql = "select * from mynews.mynews where _id='$id'";
    echo $sql."<br/>";
    $que = mysqli_query($conn, $sql);
    print_r($que);
    echo "<br/>";
   $row = mysqli_fetch_assoc($que);
    $array=mysqli_fetch_array($que);
    echo "<br/>----";
    print_r($row);
    echo "<br/>-----";
    print_r($array);
}
?><form method="post" action="new_upd.php?id=<?php echo $id ?>" onsubmit="return foo();" name="myform"><h1>修改新闻</h1><span><a href="new_list.php">返回</a></span><<Title:>p



 
    
    input type="text" name="title" value="<?php echo $row['title'] ?>"></p>
    <p>内容:<textarea cols=30 rows=5 name="content"><?php echo $row['content'] ?></textarea></p>
    <p>
        <button>>button</Modify
    </p>
    <?php
    echo "id=".$id;
    ?>

</form>
</body>
</html>

 
 


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326609371&siteId=291194637
04