PHP background and delete changes to jump

Source: Internet
Author: User

PHP Login Page:

Where dengluchuli.php is under the prescribed path.

Login Jump page:

<?php $yonghuming = $_post["UID"]; $mima = $_post["pwd"]; $db = new mysqli ("localhost", "root", "" "," 12345 "), $sql =" Select password from login where username= ' { $yonghuming} ' "; $result = $db->query ($sql); $atter = $result->fetch_row ();    if ($atter [0]== $mima &&!empty ($mima))    {header ("location:xinxi.php");} Else{echo "User name or password error";}? >

  

This page is used for login interface after successful login to find the corresponding data by user name.

Login Main interface:

<?php$de = new Mysqli ("localhost", "root", "" "," 12345 "), $e =" SELECT * from info "; $result = $de->query ($e); $atter = $ Result->fetch_all (); echo "<table border=1>"; echo "<tr><td> Code </td><td> name </td ><td> Gender </td><td> Ethnicity </td><td> date of birth </td><td> action </td>     </tr > "; for ($i =0; $i <count ($atter); $i + +) {echo" <tr> "; for ($j =0; $j <count ($atter [$i]); $j + +) {if ($j ==4) { echo "<td>". $atter [$i] [$j]. " </td>  <td><a href= ' shanchu.php?code={$atter [$i][1]} ' onclick=\ ' return confirm (' OK delete? ') \ "> Delete </a></td>";} Else{echo "<td>". $atter [$i] [$j]. " </td> ";}} echo "</tr>";} echo "</table>", echo "<a href= ' tianjia.php ' > Add Data </a>"?>

  

Add Data (tianji.php):

zeng.php:

<?php$code = $_post["Daihao"]; $name = $_post["xinming"]; $sex = $_post["Xinbie"]; $nation = $_post["Minzu"]; $birthday = $_post["Shengri"]; $db = new mysqli ("localhost", "root", "" "," 12345 "), $sql =" INSERT into info values (' {$code} ', ' {$name} ') , ' {$sex} ', ' {$nation} ', ' {$birthday} ') ", $r = $db->query ($sql), if ($r) {header (" location:xinxi.php ");} Else{echo "Add failed";}? >

  

  

Add success:

shanchu.php

<?php         $name = $_get["code"]; $db = new mysqli ("localhost", "root", "" "," 12345 "), $sql =" Delete from info where name= ' { $name} ' "; $result = $db->query ($sql); if ($result) {header (" location:xinxi.php ");} Else{echo "Delete failed";}? >

  

PHP background and delete changes to jump

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.