|
 |
|
อยากให้ textbox ส่งค่าได้หลายค่า คืออยากให้ textbox ส่งค่าได้มากกว่า1 ค่า อ่ะคับ เช่นถ้าเราต้องการพิมพ์รายงานที่เลือกจากชื่อเจ้าหน้าที่จากตางราง MySQL |
|
 |
|
|
 |
 |
|
PHP Input Text Field
*** เอาไปประยุกต์นะครับ สร้างหลายๆ Textbox ชื่อไม่ให้ซ้ำกัน
|
 |
 |
 |
 |
Date :
2009-09-02 10:06:35 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปกติก็ใช้แบบนี้หล่ะครับแต่ไม่อยากสร้างหลายตัวอยากลองใช้แบบตัวเดียวส่งหลายค่าคล้ายการพิมพ์ e-mail ใน hotmail แต่ก็ไม่แน่ใจว่ามีหรือป่าวนะ
|
 |
 |
 |
 |
Date :
2009-09-02 10:35:56 |
By :
ratasart |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มีแบบtextboxเดียวส่งได้หลายค่าไหมครับ
|
 |
 |
 |
 |
Date :
2009-09-02 13:32:57 |
By :
ratasart |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ส่ง textbox เดียว แต่ขอเป็นโค้ดแยกstring ก็ได้ครับ
|
 |
 |
 |
 |
Date :
2009-09-09 09:17:27 |
By :
ratasart |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มีปัญหา แบบเดียวกานเลย ค่า เราก็ไม่รุค่ะ อยากให้คนใจดีช่วยที +*-*+
|
 |
 |
 |
 |
Date :
2009-10-02 11:03:33 |
By :
สาวน้อย |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
$name = 'aaa,bbb,ccc,ddd';
$array_1 = explode(',', $name);
foreach( $array_1 AS $key=>$value) {
echo 'คนที่ '.$key.' ชื่อ '.$value;
}
?>
|
 |
 |
 |
 |
Date :
2009-10-02 11:19:57 |
By :
reda_008 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
if (isset($_POST['textfield'])){
echo $_POST['textfield'];
}
//เปลี่ยนให้ข้อมูลมาจาก database
$names = array('somchai','somsri','somsak','sarawut');
?>
<script>
function collect(cbEl,txEl){
var s=[];
var idx=0;
for(var i=0;i<cbEl.length;i++){
if (cbEl[i].checked){
s.push(cbEl[i].value);
}
}
txEl.value=s.join(',');
}
</script>
<form name="form2" method="post" action="">
<?php foreach($names as $index=>$name):?>
<input type="checkbox" name="cb"
id="cb<?php echo$index;?>"
value="<?php echo$name;?>" onclick="collect(this.form.cb,this.form.textfield);"
>
<label for="cb<?php echo$index;?>"><?php echo$name;?></label><br />
<?php endforeach;?>
<input type="text" name="textfield" size="100" readonly="readonly"><br />
<input type="submit" value="submit">
</form>
|
 |
 |
 |
 |
Date :
2009-10-02 11:27:04 |
By :
num |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|