데이터를 표 형식으로 표시하는 데 문제가 있습니다. 이와 같은 여러 입력 요소가 있습니다.
<form id="purchaseform" class="cv-form" method="post" action="requestmail.php" name="purchaseform" >
<input name="item_name[]" type="text" value="" id="item_name" class="input_text" />
<input name="item_brand[]" type="text" value="" id="item_brand" class="input_text"/>
<input name="model_number[]" type="text" value="" id="model_number" class="input_text"/>
<input name="item_website_catalogue[]" type="text" id="item_website_catalogue" value="" class="input_text"/>
<input type="submit">
</form>
이 양식을 제출하면 게시물 데이터는 다음과 같습니다.
[item_name] => Array (
[0] => item1
[1] => item2
)
[item_brand] => Array (
[0] => brand1
[1] => brand2
)
[model_number] => Array (
[0] => model1
[1] => model2
)
[item_website_catalogue] => Array (
[0] => source1
[1] => source2
)
여기에 데이터베이스에 삽입하지 않습니다. 이메일로 이동합니다. 이러한 데이터를 이와 같은 테이블 형식으로 표시해야합니다.
1 ----------- testitem ------------ testbrand ------- testmodel
2 ----------- testitem2 ------------ testbrand2 ------- testmodel2
제발 도와주세요. 미리 감사드립니다
이 시도...
<?php
for($i=0;$i<count($array['item_name']);$i++) {
$rows[$i]['item_name'] = $array['item_name'][$i];
$rows[$i]['item_brand'] = $array['item_brand'][$i];
$rows[$i]['model_number'] = $array['model_number'][$i];
}
?>
<table>
<tr>
<th>Item Id</th>
<th>Itemname</th>
<th>Itembrand</th>
<th>Itemmodel</th>
</tr>
<?php
$i=1;
foreach($rows as $row) {
echo '<tr>';
echo '<td>'.$i.'</td>';
echo '<td>'.$row['item_name'].'</td>';
echo '<td>'.$row['item_brand'].'</td>';
echo '<td>'.$row['model_number'].'</td>';
echo '</tr>';
$i++;
}
?>
</table>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다