PHP develops simple voting system administrator function module (4)

The main purpose here is to add the name of the new voting title in the <input> text box
Then when you click "Add New Item", it will be displayed in the voting title bar The newly added title,
and adds new data in the database.
<input name="newitem" type="text" id="newitem" /> <input type="submit" name="Submit2" value="添加新项" />
Add new items to the database table by operating the database SQL language INSERT INTO.
<?php
if(isset($_POST["Submit2"]))
{
$newitem=$_POST["newitem"];
$SQL="INSERT INTO vote (titleid,item,count) VALUES (1,'$newitem',1)";
mysqli_query($link,$sql);
}
?>Add "Exit management" after "Add new item" and jump to the voting page index.php
Exit the management main operation session, delete the session file corresponding to the current user and release session to log out as administrator.
HTML code:
<a href="?tj=out">退出管理</a>
PHP code:
<?php
if(isset($_GET['tj']) == 'out'){
session_destroy();//删除当前用户对应的session文件以及释放session
echo "<script language=javascript>alert('退出成功!');window.location='index.php'</script>";
}
?>
new file
<input name="newitem" type="text" id="newitem" />
<input type="submit" name="Submit2" value="添加新项" />
Preview
Clear
- Course Recommendations
- Courseware download
The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~
Students who have watched this course are also learning
Let's briefly talk about starting a business in PHP
Quick introduction to web front-end development
Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
Login verification and classic message board
Computer network knowledge collection
Quick Start Node.JS Full Version
The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)
















