Php + mysql how to update the form content to the database in a loop

Source: Internet
Author: User
Php + mysql: how to update the form content to the database in a loop mode? currently, I need to dynamically create a table on a webpage, for example, 10 rows. after entering the form, submit the code through the form as follows: PHPcodeecho & quot; & lt; formname & quot; form1 & quot; method & quot; post & quot; action & quot php + mysql
Currently, I need to dynamically create a table on a webpage, for example, 10 rows. fill in the form and submit it through the form.
The code is as follows:
PHP code
              echo ""; 



I want to process in process. php,
$ W = 0;
While ($ row = mysql_fetch_array ($ result ))
{
$ Filename = $ row ['filename'];
$ Time1 = $ _ POST ["$ w"];
$ W ++;
$ Time2 = $ _ POST ["$ w"];
$ W ++;
$ Time3 = $ _ POST ["$ w"];
$ W ++;
Echo "w =". $ w ."
";
$ SQL = "UPDATE fileinfo SET time1 = '". $ time1. "', time2 = '". $ time2. "', time3 = '". $ time3. "'Where filename = '". $ filename. "'";
$ Re = mysql_query ($ SQL) or die ("error:". mysql_error ());
Echo $ SQL. "--- the result is:". $ re ."
";
}

$ Time1, $ time2, and $ time3 from post are all null values. it cannot be changed to $ time1 = $ _ POST [$ w, $ time1 = $ _ POST ['$ W'] doesn't work either. I don't know if the value in $ _ POST [] can be a variable. how can I represent it .... How can this problem be solved when a table is submitted !!

------ Solution --------------------
Check the front-end page. is the name correct?
------ Solution --------------------
Try this way
PHP code
$ I = 0; while ($ row = mysql_fetch_array ($ result) {echo""; Echo"". $ Row ['filename'].""; Echo"". $ Row ['filesize'].""; // The data table contains the file name and file size, but the default playback time is 0. update the database echo by modifying the webpage"\ "Type = \" text \ ">"; Echo"\ "Type = \" text \ ">"; Echo"\ "Type = \" text \ ">"; Echo""; $ I ++ ;}
------ Solution --------------------
Print_r ($ _ POST );
------ Solution --------------------
Echo"\ "Type = \" text \ ">";
Echo"\ "Type = \" text \ ">";

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.