พบกับบทความเกี่ยวกับคอมพิวเตอร์และ programming ได้ที่ http://articles.modoeye.com | บล็อกอาหาร
PHP development / ช่วยดูหน่อยครับ
KK
KK
Sun 17 Aug 2008 23:49:21

      <input name="month" type="radio" value="48" checked="checked"  />
      48เดือน
      <input name="month" type="radio" value="60"  />
      60เดือน
      <input name="month" type="radio" value="72" />
      72เดือน

จากโค๊ตด้านบนผมจะทำยังไงให้ Radio Button แต่ละอันเก็บค่าเมื่อกดปุ่ม

เช่น กดปุ่ม 48 เดือน ให้มันมีค่า $month=48; อ่ะครับ

webmaster
webmaster
Sun 17 Aug 2008 23:56:58
ปกติก็ส่งค่าไปได้อยู่แล้วนี่ครับไม่ว่าคุณจะ GET หรือ POST
KK
KK
Mon 18 Aug 2008 00:11:00

$month = $_POST['month'] ;  ไว้ที่หัวครับ

เกี่ยวกับการที่ผมส่งค่าตัวแปรไปที่อีกหน้าหรือเปล่าครับ

('finance3.php?id_type=<? echo $price3?>&id_month=<? echo $month?>','','status=yes,width=600,height=220')

webmaster
webmaster
Mon 18 Aug 2008 11:30:40
print_r($_POST);

ลองดูครับว่ามีค่าใด post มาบ้าง
KK
KK
Wed 20 Aug 2008 00:14:35

แสดงออกมาแบบนี่ครับ

Array ( ) 1 

webmaster
webmaster
Wed 20 Aug 2008 12:23:19
แปลว่าไม่มีการ POST มา มั่นใจว่ามีการ POST ค่ามาหรือเปล่าครับ
KK
KK
Wed 20 Aug 2008 12:41:54

งงเหมือนกันครับไม่ทราบว่าผิดตรงไหน 

<? $month = $_POST['month'] ; ?>
    <tr>
      <td>&nbsp;</td>
      <td class="style6"><div align="left">ผ่อนชำระ</div></td>
      <td>&nbsp;</td>
      <td colspan="2"><label class="style6">
      <input name="month" type="radio" value="48" checked="checked"  />
      48เดือน
      <input name="month" type="radio" value="60"  />
      60เดือน
      <input name="month" type="radio" value="72" />
      72เดือน
      </label>
        <span class="style6">
        <label>
        <input name="month" type="radio" value="84" />
        84เดือน</label>
        </span>

        <label><img src="pic/คำนวรอัตราผ่อนชำระ.jpg" width="100" height="20" style="cursor:hand" longdesc="pic/คำนวรอัตราผ่อนชำระ.jpg" onclick="MM_openBrWindow('finance3.php?id_type=<? echo $price3?>&id_month=<? echo $month?>','','status=yes,width=600,height=220')" /></label></td>

webmaster
webmaster
Wed 20 Aug 2008 15:00:17
ก็ในเมื่อไม่มีค่าใดๆ POST มาตัวแปร $month ก็จะไม่มีค่าใดๆ
KK
KK
Wed 20 Aug 2008 17:50:02

แล้วไม่ทราบว่าผมต้องเพิ่มเติมตรงไหนครับ รู้สึกงงๆ

รบกวนหน่อยครับ

KK
KK
Wed 20 Aug 2008 18:39:09

ตอนนี้เข้าใจแล้วครับ มันต้องส่งค่าจากฟอร์มไปอีกหน้าถึงจะได้ครับ แต่ในกรณีของผมใช้วิธีส่งจากปุ่มที่เป็นรูปภาพส่งเป็นตัวแปรไปมันเลยส่งไปไม่ได้ครับ ไม่ทราบมีวิธีแนะนำมั้ยครับ

webmaster
webmaster
Wed 20 Aug 2008 23:22:24
การส่งค่าแบบ POST คุณต้องส่งจาก form ครับ
Boat
Boat
Thu 21 Aug 2008 01:37:11

แก้ได้แล้วจ้า

ขอบคุณสำหรับความช่วยเหลือจ้า

Reply
Name:
E-mail:
Home | Services | Forum | Classified | Directories | Support | Contact
ATOM feed RSS 0.9 feed RSS 1.0 feed RSS 2.0 feed
Copyright © 2005 - 2007 Modoeye.com, All Rights Reserved.
Disclaimer | Privacy policy | Term of Use | Term of Services
Valid XHTML Valid CSS! PHP: Hypertext Preprocessor MySQL database Apache Powered! FreeBSD Power to serve
Modoeye Sitemap Client login