ติดต่อลงโฆษณา [email protected]

ผู้เขียน หัวข้อ: วิธีการทำให้ข็อมูลที่สมาชิกเลือก (จาก dropdown list) เข้าไปในตารางและแสดง  (อ่าน 12701 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ sutthipr

  • New Member
  • *
  • กระทู้: 1
    • ดูรายละเอียด
สวัสดีครับสมาชิกใหม่มากครับ เพิ่งค้นเจอเว็บนี้มีประโยชน์มากครับ

วันนี้มีเรื่องมารบกวนซักหน่อยครับ


ต้องการ :วัตถุประสงค์คือตอนนี้ต้องการใส่ รุ่นรถยนต์แบบ dropdown list ลงใน profile และ ให้แสดงใน display หน้า post กระทู้ด้วย

Version : SMF 1.1.11

รายละเอียดและ action ที่ทดลองทำ (มือใหม่): ต้อนนี้ลองคัดลอก code มาจากการแสดงเพศของสมาชิก gender โดยเปลี่ยนชื่อ 'gender' เป็น 'model' รายระเอียดดังนี้ครับ

1 ได้ทำการ mod file: Profile.php

   //Set the model "name"
   switch($_POST['model'])
   {
       case 6:
      $modelname = 'g';
      break;   
       case 5:
      $modelname = 'e';
      break;
       case 4:
      $modelname = 'd';
      break;
       case 3:
      $modelname = 'c';
      break;
       case 2:
      $modelname = 'b';
      break;
       case 1:
      $modelname = 'a';
      break;
       default:
      $modelname = '';
      break;
   }

-----------------------------------------------------------------

   // Overwrite member settings with the ones you selected.

      ),
      'model' => array(
         'name' => $modelname

---------------------------------------------------------------------
จบ
===================================================================

2. Mod : ManageMembers.php

         'model' => array(
            'db_fields' => array('model'),
            'type' => 'checkbox',
            'values' => array('0', '1', '2','3','4','5','6'),   
===================================================================

3. mod : Profile.template.php


    // Focus Model.
   echo '                                       
      <tr>
            <td width="40%">', $txt[995], ': </td>
         <td>
         <select name="model" size="1">
         <option value="0"></option>
         <option value="1"', ($context['member']['model']['name'] == 'a' ? ' selected="selected"' : ''), '>', $txt[994], '</option>
         <option value="2"', ($context['member']['model']['name'] == 'b' ? ' selected="selected"' : ''), '>', $txt[993], '</option>
         <option value="3"', ($context['member']['model']['name'] == 'c' ? ' selected="selected"' : ''), '>', $txt[992], '</option>
         <option value="4"', ($context['member']['model']['name'] == 'd' ? ' selected="selected"' : ''), '>', $txt[991], '</option>
         <option value="5"', ($context['member']['model']['name'] == 'e' ? ' selected="selected"' : ''), '>', $txt[990], '</option>
         <option value="6"', ($context['member']['model']['name'] == 'g' ? ' selected="selected"' : ''), '>', $txt[989], '</option>               
        </select>
                   </td>
                                    </tr><tr>
                <td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
                                  </tr>';

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

============================================================================================================================

4. mod : Managemembers.template.php


<tr>
      <th align="right">', $txt[995], ':</th>
      <td align="left" colspan="2">
         <label for="model-0"><input type="checkbox" name="model[]" value="0" id="model-0" checked="checked" class="check" /> ', $txt['undefined_model'], '</label>&nbsp;&nbsp;
         <label for="model-1"><input type="checkbox" name="model[]" value="1" id="model-1" checked="checked" class="check" /> ', $txt[994], '</label>&nbsp;&nbsp;
         <label for="model-2"><input type="checkbox" name="model[]" value="2" id="model-2" checked="checked" class="check" /> ', $txt[993], '</label>&nbsp;&nbsp;
                                                                <label for="model-3"><input type="checkbox" name="model[]" value="3" id="model-3" checked="checked" class="check" /> ', $txt[992], '</label>&nbsp;&nbsp;
         <label for="model-4"><input type="checkbox" name="model[]" value="4" id="model-4" checked="checked" class="check" /> ', $txt[991], '</label>&nbsp;&nbsp;
         <label for="model-5"><input type="checkbox" name="model[]" value="5" id="model-5" checked="checked" class="check" /> ', $txt[990], '</label>&nbsp;&nbsp;
         <label for="model-6"><input type="checkbox" name="model[]" value="6" id="model-6" checked="checked" class="check" /> ', $txt[989], '</label>
      </td>

========================================================================================================================



ผลที่ได้คือ   มีคำว่า   รุ่นรถ: ปรากฏถูกต้องใน profile แต่  เมื่อเลือกและ save    ปรากฏว่าข้อมูลไม่ เข้าไปใน profile



สรุป :  รบกวนแนะนำด้วยครับ ต้องการ 2 หัวข้อครับ

1 ทำอย่างไรให้ระบบรับข้อมูลของเราไว้ในตาราง พร้อมทั้ง display   ที่ profile ของสมาชิก ตลอดจนสามารถเปลี่ยนได้ตามต้องการ

2. รบวน code ที่จะดึงขอมูลที่เราเลือกได้แล้วให้แสดงใน display ที่ profile display ในหน้า post กระทู้



ขอบคุณมากเลยนะครับ

งมมั่วมานานแล้วครับ ขอความกรุณาด้วยครับ


ออฟไลน์ wernereegranad75

  • New Member
  • *
  • กระทู้: 12
    • ดูรายละเอียด
Hello there buddy, thank you so much for sharing this awesome guide on "How to get member's selected data (from dropdown list) into table and display". This is a great way for new user of this software to get a grasp of command for this. I hope that more people can see this thread you created. Get this horror hospital 2 game or hair makeover game if you want to try some top grossing games in the Play Store right now.

ออฟไลน์ rahulvermabarbe

  • New Member
  • *
  • กระทู้: 11
    • ดูรายละเอียด
Twitch has everything to offer – games, talk shows, sports, music, just chatting, travel & outdoors, and special events. All you have to do is to find your thing, activate Twitch at www twitch TV activate and watch what you love. You can connect with streamers and chat with millions of communities.
twitch activate