PHP generates an array by setting the table cell Name property

Source: Internet
Author: User

<form method= "POST" action= "<?php$_server[' php_self '];?> ">//use self-referencing form, $_server[' php_self '] variable to display the PHP file's own filename<?PHP//connect to MySQL database$dbc=Mysqli_connect(' localhost ', ' root ', ' root ', ' test_store ') or die(' Error conneting to MySQL server. '));//determine if the form has been submittedif(isset($_post[' Submit '])){    foreach($_post[' Todelete '] as $delete _id){
//$_post[' Todelete ' is the todelete[] array, and the value of the selected check box will exist in this array $query= "Delete from email_list where id=$delete _id"; Mysqli_query($dbc,$query) or die(' ERROR delete data '.); } Echo"Email is removed.<br/>";}//querying email_list Data Sheets$query= "SELECT * FROM Email_list";$result=Mysqli_query($dbc,$query) or die(' ERROR select database. '));//Generate check box while($row=Mysqli_fetch_array($result) { //$result stores the entire data table to which the query is stored, while each time the $row array stores a row of data in the data table. Echo' <input type= ' checkbox ' value= '.$row[' ID ']. ' " Name= "todelete[]"/> "; //Note the Name property of the Chinese bracket Echo $row[' Email ']; Echo' <br/> ';}//to close a connection to a databaseMysqli_close($dbc);&GT;&LT;BR/><input type= "Submit" name= "submit" value= "Submit" ></form>

PHP generates an array by setting the table cell Name property

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.