如何重复数组和字符串:
$name = array (ade, ian, yasin);
$title = 'IT';
如何重复以使结果如下?
感谢
答案 0 :(得分:0)
解决问题
<form method="post" action="#">
isi :<input type="text" name="isi">
title :<input type="text" name="title">
<table>
<tr>
<td><input type="text" name="name[]"></td>
</tr>
<tr>
<td><input type="text" name="name[]"></td>
</tr>
<tr>
<td><input type="text" name="name[]"></td>
</tr>
<tr>
<td><input type="text" name="name[]"></td>
</tr>
<tr>
<td><input type="text" name="name[]"></td>
</tr>
</table>
<input type="submit" value="submit">
</form>
<?php
$rowCount = count($_POST['name']);
$record=array();
for ($i=0; $i<$rowCount;$i++)
{
$record[]=array(
'nama' => $_POST['name'][$i],
'isi' => $_POST['isi'],
'title' =>$_POST['title']
);
}
foreach ($record as $key => $a)
{
echo "".$a['nama'] ." ". $a['isi']." ".$a['title']."<br>";
}
?>