PHP develops si...LOGIN

PHP develops simple voting system administrator function module (1)

115.png

There is a modify title button at the head of the simple voting system, which is used by the administrator to modify the voting theme after logging in.

The main idea is to first change the title in the database The existing title content is output through the SQL statement SELECT query and displayed in the title box.

Modify the title content directly in the title box. After clicking "Title Modification", modify the database title content directly through the SQL statement UPDATE statement.

In the previous section we created a database table votetitle and added a piece of content.

<?php
$SQL = "INSERT INTO votetitle VALUES ('1', '您认为本网站还有那些要做调整?');"
?>

Query this statement through the SQL statement and display it in the modify <input> box through <input valua =" content"> output

<?php
$sql="select * from votetitle";
$rs=mysqli_query($link,$sql);
$rows=mysqli_fetch_assoc($rs);
?>

Through <input valua = "Content">Output

<input name="title" type="text" id="title" size="35" value="<?php echo $rows["votetitle"]?>" />

A submit is required here.

<input type="submit" name="Submit" value="修改标题" />

Modify the database title content through the SQL statement UPDATE statement

<?php
if(isset($_POST["Submit"]))
{
$title=$_POST["title"];
$sql="update votetitle set votetitle='$title'";
mysqli_query($link,$sql);
}
?>

  <script language="javascript">
    alert("修改成功");
  </script>


Next Section
<?php if(isset($_POST["Submit"])) { $title=$_POST["title"]; $sql="update votetitle set votetitle='$title'"; mysqli_query($link,$sql); } ?>
submitReset Code
ChapterCourseware