search

Home  >  Q&A  >  body text

How to sort and output the registration list

<body>

<!-- Create a multi-dimensional array containing student number, name, and age. The form transfers the data to the array and stores it. The array outputs all data in sorted order

This page is bm.php. Fill in the form data on this page. After clicking submit, enter all registered lists directly below the form.

-->

<? php


var arr=new Array();//Define array


?>


<form method="post" action="bm.php">

<label>Reading Notice Registration Office</label><br />

Seat number:<input type="text" name="hao" value="arr[0]"/><br/>

Name: <input type="text" name="xm" value="arr[1]"/><br/>


##<input type= "submit" value="submit">


</form>




##The following students have been informed<br/>


#< ?php

var myform=document.getElementsByTagName('form')[0];

var xinp=myform.getElementsByTagName('input');//Get all input boxes in the form

for(var i=0;i<xinp.length;i )//Loop

{

echo arr[i]=xinp[i].value;/ /Pay the value in each input box to the corresponding item in the array

}

天行健天行健2701 days ago1353

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-07-28 08:35:30

    JavaScript array has built-in sorting function

    reply
    0
  • Cancelreply