รบกวนแก้ code ให้หน่อยค่ะ

เริ่มโดย test_one, 26 มกราคม 2012, 01:20:25

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

MeenyFancy


<form id="dateCarGroup" name="dateCarGroup"  method="post" action="frm_type.php" enctype="multipart/form-data" >
      <table width="100%" border="0" cellpadding="5" cellspacing="5">
        <tr>
          <td width="15%"><div align="right"><span style="font-weight: bold">Start : </span></div></td>
          <td width="28%"><input name="st_date" type="text" id="st_date" value="<? echo date("Y-m-d"); ?>"/>     </td>
  <td width="17%">&nbsp;</td>
  <td width="40"></td>
        </tr>
        <tr>
          <td colspan="4" align="center">
  <? $r=0; while($row  < count($type)){?>
<input type="radio" name="type_id" id="type_id" value='<?= $q_type[$r]["type_id"] ?>' /> <?= $q_type[$r]["type_name"]?>
  <? $r++;} ?>
  </td>
          </tr>
      </table>
  <input type="submit" value='submit' />
        </form>


เขียนแบบไม่ได้รัน ไม่รู้ผ่านมั้ย ถ้าไม่ผ่านลองแก้ดูครับ ราวๆ นี้แหละ
Have a good trip.
[direct=http://petdeecare.com]สุนัขป่วย[/direct] [direct=http://petdeecare.com]แมวป่วย[/direct]
[direct=http://petdeecare.com]หนูป่วย[/direct] [direct=http://petdeecare.com]อาหารแมว[/direct] [direct=http://petdeecare.com]อาหารหมา[/direct]

sleepcat

<form id="dateCarGroup" name="dateCarGroup"  method="post" action="frm_type.php" enctype="multipart/form-data" >

การส่งแบบ enctype="multipart/form-data" จะเป็นการส่งแบบส่งไฟล์ คือเป็น binary ดังนั้น การจะดึงข้อมูลโดยใช้ $_POST[''] แบบนี้ตรง ๆ ไม่ได้ ต้องมา Object ในการอ่าน binary มาอ่าน แล้วแยกข้อมูลออกมาครับ ดังนั้น ถ้าไม่ได้ส่งไฟล์ไปด้วย ควรตัดออกครับ

test_one

อ้างถึงจาก: MeenyFancy ใน 26 มกราคม 2012, 11:20:25

<form id="dateCarGroup" name="dateCarGroup"  method="post" action="frm_type.php" enctype="multipart/form-data" >
      <table width="100%" border="0" cellpadding="5" cellspacing="5">
        <tr>
          <td width="15%"><div align="right"><span style="font-weight: bold">Start : </span></div></td>
          <td width="28%"><input name="st_date" type="text" id="st_date" value="<? echo date("Y-m-d"); ?>"/>     </td>
  <td width="17%">&nbsp;</td>
  <td width="40"></td>
        </tr>
        <tr>
          <td colspan="4" align="center">
  <? $r=0; while($row  < count($type)){?>
<input type="radio" name="type_id" id="type_id" value='<?= $q_type[$r]["type_id"] ?>' /> <?= $q_type[$r]["type_name"]?>
  <? $r++;} ?>
  </td>
          </tr>
      </table>
  <input type="submit" value='submit' />
        </form>


เขียนแบบไม่ได้รัน ไม่รู้ผ่านมั้ย ถ้าไม่ผ่านลองแก้ดูครับ ราวๆ นี้แหละ

ปกติ แล้ว ถ้า ทำแบบ  type="submit"   แล้ว ส่งค่า ไม่ได้ หรอ ค่ะ แบบนั้น ต้อง  type="radio"   อย่าง เดียวหรอ ค่ะ  ลอง ทำแบบ  type="radio"    ได้ แล้วค่ะ แต่ อยากทำแบบ type="submit"  มากกว่าค่ะ พอจะมีวิธีไหมค่ะ

MeenyFancy

ทำฟอร์มซ้อนใน loop ครับ

  <? $r=0; while($row  < count($type)){?>
<form id="dateCarGroup" name="dateCarGroup"  method="post" action="frm_type.php" enctype="multipart/form-data" >
<input type="submit" name="type_name" id="type_name" value='<?= $q_type[$r]["type_name"]?>' />
<input type="hidden" name="type_id" id="type_id" value='<?= $q_type[$r]["type_id"] ?>' />
</form>
  <? $r++;} ?>
Have a good trip.
[direct=http://petdeecare.com]สุนัขป่วย[/direct] [direct=http://petdeecare.com]แมวป่วย[/direct]
[direct=http://petdeecare.com]หนูป่วย[/direct] [direct=http://petdeecare.com]อาหารแมว[/direct] [direct=http://petdeecare.com]อาหารหมา[/direct]

test_one

อ้างถึงจาก: MeenyFancy ใน 26 มกราคม 2012, 11:45:51
ทำฟอร์มซ้อนใน loop ครับ

  <? $r=0; while($row  < count($type)){?>
<form id="dateCarGroup" name="dateCarGroup"  method="post" action="frm_type.php" enctype="multipart/form-data" >
<input type="submit" name="type_name" id="type_name" value='<?= $q_type[$r]["type_name"]?>' />
<input type="hidden" name="type_id" id="type_id" value='<?= $q_type[$r]["type_id"] ?>' />
</form>
  <? $r++;} ?>

แล้วค่าที่อยู่ นอก loop  จะตามไปด้วยไหม ค่ะ

MeenyFancy

อ้างถึงจาก: test_one ใน 26 มกราคม 2012, 11:50:31
อ้างถึงจาก: MeenyFancy ใน 26 มกราคม 2012, 11:45:51
ทำฟอร์มซ้อนใน loop ครับ

  <? $r=0; while($row  < count($type)){?>
<form id="dateCarGroup" name="dateCarGroup"  method="post" action="frm_type.php" enctype="multipart/form-data" >
<input type="submit" name="type_name" id="type_name" value='<?= $q_type[$r]["type_name"]?>' />
<input type="hidden" name="type_id" id="type_id" value='<?= $q_type[$r]["type_id"] ?>' />
</form>
  <? $r++;} ?>

แล้วค่าที่อยู่ นอก loop  จะตามไปด้วยไหม ค่ะ
ตามไปแค่ ใน form ครับถ้าไม่ใช้วิธีเลือก radio ก็ต้องทำแบบนี้
จริงๆ มันก็มีอีกหลายวิธี แต่ใช้พวก java มาช่วย html เพียวๆ ไม่ได้
Have a good trip.
[direct=http://petdeecare.com]สุนัขป่วย[/direct] [direct=http://petdeecare.com]แมวป่วย[/direct]
[direct=http://petdeecare.com]หนูป่วย[/direct] [direct=http://petdeecare.com]อาหารแมว[/direct] [direct=http://petdeecare.com]อาหารหมา[/direct]