###前提・実現したいこと
一行目に見出し、二行目に各データを編集するテキストボックスを入れたいと思っています。
htmlのテーブル内にテキストボックスを入れる際に、列の幅を
列の見出しの長さ > テキストボックスのvalueの文字列値の長さ
だった場合には列の幅を見出しの幅に合わせて、
列の見出しの長さ < テキストボックスのvalueの文字列値の長さ
だった場合には列の幅をテキストボックスのvalueの文字列値の長さに合わせたいと思っています。
ご教授いただけますと幸いです。。。
###該当のソースコード
lang
1foreach ($sql->fetchAll() as $row) { 2 echo '<table border="1" width:100%>'; 3 echo '<form action="from-search-detail.php" method="POST">'; 4 echo '<tr><th style="white-space:nowrap">受注NO</th><th>顧客名</th><th>ステータス</th><th>受注案件名</th><th>商品名</th> 5 <th>仕様</th><th>数量</th><th>納期</th><th>受注価格</th><th>受注日</th><th>担当者</th></tr>'; 6 echo '<tr><td style="position:relative"> 7 <input type="text name="orderFromNO" value="',$row['orderFromNO'],'"style="width:100%;box-sizing:border-box"> 8 </td>'; 9 echo '<td style="position:relative"> 10 <input type="text name="customer" value="',$row['customer'],'"style="width:100%; box-sizing:border-box"> 11 </td>'; 12 echo '<td style="position:relative"> 13 <input type="text name="status" value="',$row['status'],'"style="width:100%; box-sizing:border-box"> 14 </td>'; 15 echo '<td style="position:relative"> 16 <input type="text name="projects" value="',$row['projects'],'"style="width:100%; box-sizing:border-box"> 17 </td>'; 18 echo '<td style="position:relative"> 19 <input type="text name="product" value="',$row['product'],'"style="width:100%; box-sizing:border-box"> 20 </td>'; 21 echo '<td style="position:relative"> 22 <input type="text name="specification" value="',$row['specification'],'"style="width:100%; box-sizing:border-box"> 23 </td>'; 24 echo '<td style="position:relative"> 25 <input type="text name="num" value="',$row['num'],'"style="width:100%; box-sizing:border-box"> 26 </td>'; 27 echo '<td>' .$row['deliveryDate']. '</td>'; 28 echo '<td style="position:relative"> 29 <input type="text name="price" value="',$row['price'],'"style="width:100%; box-sizing:border-box"> 30 </td>'; 31 $from_price = $row['price']; 32 echo '<td>' .$row['fromDate']. '</td>'; 33 echo '<td style="position:relative"> 34 <input type="text name="leader" value="',$row['leader'],'"style="width:100%; box-sizing:border-box"> 35 </td>'; 36 echo '<td><input type="submit" name="update" value="更新"></td>'; 37 echo '</form>'; 38 echo '</tr>'; 39 } 40 echo '</table>';
###試したこと
nowrapやwidthなどいろいろ変えてみましたが思うようにいかず・・・
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/13 07:00
2017/06/14 02:27
2017/06/14 07:54