受注をキャプチャするPHPページがあります。それは、選択された値に基づいてmysqlテーブル情報を取得する依存ドロップダウンリストを持っています。 依存ドロップダウンリストの更新時に入力ボックスの値を変数として保存します。
ユーザーが注文数量を入力
は、私はいくつかのことが起こるしたい:まず、入力された値が変数$ line1qtyに記述する必要があります。私はエントリがあります:
<? $line1qty=$_POST[line1qty]; ?>
私のコードでこれは動作していませんが、私はそれがJavaScriptがページを更新するときに設定されているかどうかわかりません。次に、次の表の行が表示され、最大72の表エントリがあります。選択した値のないすべての行がデフォルトで非表示になります。
私はちょうど単純なものがありませんが、PHPにはまだまだ慣れていないことを知っています。再度、感謝します。
ページのための私のコードは次のとおりです。
<style type="text/css">
<!--
@import url("style.css");
-->
</style>
<script language="JavaScript">
function autoSubmit()
{
var formObject = document.forms['theForm'];
formObject.submit();
}
</script>
<?php
$packcode = $category = $sellingunit = null; //declare vars
if(isset($_GET["packcode"]) && is_numeric($_GET["packcode"]))
{
$packcode = $_GET["packcode"];
}
if(isset($_GET["category"]) && is_numeric($_GET["category"]))
{
$category = $_GET["category"];
}
if(isset($_GET["sellingunit"]) && is_numeric($_GET["sellingunit"]))
{
$sellingunit = $_GET["sellingunit"];
}
?>
<form name="theForm" method="get">
<? $line1qty=$_POST[line1qty]; ?>
Capture the sales data
<table id="hor-minimalist-a">
<tr>
<th valign=bottom>
Select a Pack Code
</th>
<th valign=bottom>
Category
</th>
<th valign=bottom>
Selling <br> Units
</th>
<th valign=bottom>
<b>Grouping</b>
</th>
<th valign=bottom>
<b>Full Pallet<br>QTY</b>
</th>
<th valign=bottom>
<font color=red><b>Order QTY</b></font>
</th>
<th valign=bottom>
<font color=green><b>Points</b></font>
</th>
</tr>
<tr>
<td>
<select name="packcode" onChange="autoSubmit();">
<option value="null"></option>
<option value="1046" <?php if($packcode == 1046) echo " selected"; ?>>1046 - Domestos Liq Lemon 20x750ml</option>
<option value="1174" <?php if($packcode == 1174) echo " selected"; ?>>1174 - Omo Wash Pwdr MultiActiv6x6x500g</option>
<option value="1175" <?php if($packcode == 1175) echo " selected"; ?>>1175 - Surf Wash Pwdr Reg 6x6x500g</option>
<option value="1182" <?php if($packcode == 1182) echo " selected"; ?>>1182 - Breeze Soap Amber 8x12x125g</option>
</select>
</td>
<td width=75>
<?php
if($packcode != null && is_numeric($packcode))
{
//POPULATE category
$sql = "SELECT packcode, sellingunits, category,casesperpallet,grouping,shrinksperpallet FROM skudata WHERE packcode = $packcode";
$data = mysql_query($sql);
while($row = mysql_fetch_array($data))
{
echo $row[category];
?>
</td>
<td width=75>
<? echo $row[sellingunits]; ?>
</td>
<td width=75>
<? echo $row[grouping]; ?>
</td>
<td width=75>
<? if($row[sellingunits]=="CS"){echo $row[casesperpallet];} else {echo $row[shrinksperpallet];} ?>
</td>
<td width=75>
<? if($line1qty > 0){ ?>
<input type=text name=line1qty id=line1qty size=3 value=<? echo $line1qty; ?> style=" color: red;text-align: center" onChange="autoSubmit();>
<? } else { ?>
<input type=text name=line1qty id=line1qty size=3 style="color: red;text-align: center">
<? } ?>
</td>
<td width=75>
<input type=text name=line1points id=line1points size=3 disabled>
</td>
</tr>
<?
}}
?>
おかげで再び、このフォーラムが提供する支援を感謝しています。
は良い一日を、 ライアンこれらの行で
データを更新するために 'POST 'を使って' AJAX'呼び出しを使うことはできますが、質問はまだ私には分かりません。あなたは何を簡単にしようとしていますか? – Sudantha