Skip to content

Instantly share code, notes, and snippets.

<?php
class Introduce {
private $arraylist = array();
public function regist($num) {
$this->arraylist[] = $num;
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>form1</title></head><body><form action="form0302.php" method="post">  番号:<br />  <input type="text" name="index" size="30" ><br />  名前:<br />  <input type="text" name="name" size="30" ><br />  自己紹介文:<br />  <input type="text" name="introduce" size="30" ><br />   <input type="submit" value="登録する"  ><br/><table border='1'><tr><th>id</th><th>名前</th><th>自己紹介</th></tr><?phprequire_once 'Introduct0332.php';if (isset($_POST["index"]) && isset($_POST["name"]) && isset($_POST["introduce"])){ $x=$_POST['index']; $y=$_POST['name']; $z=$_POST['introduce'];   $object=new Introduct(); $object->regist_file($x,$y,$z); $object->showAll();    $size= sizeof(file("file.csv"));    echo "<tr>"; for($i = 0; $i < count($array); ++$i ){  $elem = nl2br(mb_convert_encoding($array[$i], 'UTF-8'));  $elem = $elem === "" ?  "&nbsp;" : $elem;  echo("<td>".$elem."</td>"); } echo "</tr>";} ?></body></html> 
@raplas
raplas / Introduct0332.php
Last active March 2, 2017 13:18
form.php
<?php
class Introduct {
public function regist_file($x,$y,$z){
$fp = fopen("file.csv", "a");
fwrite($fp, "$x,");
fwrite($fp, "$y,");
fwrite($fp, "$z \n");
fclose($fp );