【问题标题】:how to repeat array and string [closed]如何重复数组和字符串
【发布时间】:2016-01-23 05:11:45
【问题描述】:

如何重复数组和字符串:

$name = array (ade, ian, yasin);
$title = 'IT';

如何重复,结果如下?

  • 宣传它
  • 伊恩 IT
  • yasin IT

谢谢

【问题讨论】:

  • 这是什么语言?
  • 我想重复数组和字符串。好的。前进。您已获得我们的许可。

标签: arrays string repeat


【解决方案1】:

问题解决

    <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>";
  }

?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-04
    • 1970-01-01
    • 1970-01-01
    • 2016-03-22
    • 1970-01-01
    • 2021-06-22
    相关资源
    最近更新 更多