1
我張貼值OG動態現在我使用此笨腳本發佈它在數據的基礎上創建的輸入字段中陣列fromat如何發佈3輸入字段張貼的值在ARRY到數據庫
<form method='post' action='<?php echo site_url('a3_bus_system/output')?>'>
<div class="_25">
<strong>Route Name/Number</strong>
<br/>
<input type="text" name=""></input>
</div>
<p> <p> </p></p>
<p> <p> </p></p>
<div id="div">
</div>
<p> </p><div class="_25">
<p><input type="button" name="button" class="button red" id="button" value="Add" onclick="generateRow() "/></a></p>
</div>
<input type='button' value='Remove Button' id='removeButton'>
<p> </p><p> </p></div>
<input type="submit" class="button blue" id="button" value="Register" />
/form>
</div>
</div>
<div class="clear height-fix"></div>
</div></div> <!--! end of #main-content -->
</div> <!--! end of #main -->
<script>
var counter=1;
function generateRow() {
var count="<font color='red'>"+counter+"</font>";
var temp =" <p> <div class='_25'><input type='textbox' id='textbox' name='stop["+counter+"]' placeholder='Stop Name'></input></div> <div class='_25'><input type='textbox' id='textbox' name='timing["+counter+"]' placeholder='Timing'></input></div> <div class='_25'><select id='ampm' name='ampm["+counter+"]'><option>a.m</option><option>p.m</option></select> </div>";
var newdiv = document.createElement('div');
newdiv.innerHTML = temp + count;
var yourDiv = document.getElementById('div');
yourDiv.appendChild(newdiv);
counter++;
}
</script>
// form 1st text box input
foreach ($_POST['stop'] as $stopIndex => $stopValue) {
$sql="INSERT INTO t_routes_list(stop_name) VALUES('".$this->db->escape_str($stopValue)."')";
$this->db->query($sql);
}
// form 2nd text box input
foreach ($_POST['timing'] as $timingIndex => $timingValue)
{
$sql="INSERT INTO t_routes_list(timing) VALUES('".$this->db->escape_str($timingValue)."')";
$this->db->query($sql);
}
// form 3rd select box input
foreach ($_POST['ampm'] as $ampmIndex => $ampmValue) {
$sql="INSERT INTO t_routes_list(am_pm) VALUES('".$this->db->escape_str($ampmValue)."')";
$this->db->query($sql);
}
現在1要發佈僅1其中輸入數據1 ..但是,當我張貼的所有字段過得去空值
發佈如何同時發佈的所有數據?
編碼器的請求幫助我的PHP腳本