Je veux obtenir une entrée d'un formulaire et l'enregistrer dans un tableau php et imprimer le tableau.Il y a deux fichiers à savoir array.php et marks.php.Je pense que je suis en désordre statique .Aidez-moi, s'il vous plaît!obtenir la sortie de ce code php
marks.php
<style type="text/css">
.my_table{
margin-top:150px;
margin-left:400px;
}
</style>
<?php
if(!isset($_POST['send'])){
?>
<table align='center' class='my_table'>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<tr><th></th><th align='left'>Student Marks</th></tr>
<tr><td>enter subject</td><td><input type='text' name='subject'></td></tr>
<tr><td>enter marks</td><td><input type='text' name='marks'></td></tr>
<tr><td colspan='2' align='right'><input type='submit' value='submit' name='send'/> </td></tr>
</form>
</table>
<?php
}
else{
include 'array.php';
$svtoarray=new SaveMarks();
$svtoarray->addToArray($_POST['marks']);
$svtoarray->printArray();
}
?>
array.php
<?php
class SaveMarks{
static $index=0;
function SaveMarks(){
}
static $marks=array();
function addToArray($value){
$marks[$index]=$value;
$index++;
}
function printArray(){
$countarr=count($marks);
for($ind=0;$ind<$countarr;$ind++){
print $marks[ind];
}
}
}
?>
$ _POST est en soi un tableau. Pourquoi toutes les choses compliquées? Je pense –
'
' 'est mieux que