我是一个新的 php 初学者,正在从事一个彩票项目..每次抽奖我有 5 个输入文本字段,总抽奖是 10 个抽奖,9 个隐藏它仅在玩家选择要玩的抽奖数量时显示...
这里遇到的问题是我将如何将 5 个拣货号码插入数据库中......这就是我所做的
$game1 = (int) $_POST['game1_mainball3'] . "-" . (int) $_POST['game1_mainball2'] . "-" . (int) $_POST['game1_mainball3'] . "-" . (int) $_POST['game1_mainball4'] . "-" . (int) $_POST['game1_mainball5'];
我在插入数据时默认绘制$game1
它只插入$_POST['game1_mainball3']
到列中
这是我的插入代码
$sql = "INSERT INTO tickets (drawdate, drawtime, ticket_no) VALUES ('$drawdate','$drawtime','$game1')";
mysql_query($sql);
我真的很喜欢你的回复..但我想也许是我的表格名称有问题,也许影响它的是我发布的表格
游戏 1 或 游戏类型 <div class="fields" id="game_set_2" style="display: none;"><div class="lotto_game">Game 2</div><input onkeypress="return EnterKeyHandler(this, event)" type="text" title="Game 2 - Ball 1" class="text_num" name="game2_mainball1" id="game2_mainball1" maxlength="2"> <input onkeypress="return EnterKeyHandler(this, event)" type="text" title="Game 2 - Ball 2" class="text_num" name="game2_mainball2" id="game2_mainball2" maxlength="2"> <input onkeypress="return EnterKeyHandler(this, event)" type="text" title="Game 2 - Ball 3" class="text_num" name="game2_mainball3" id="game2_mainball3" maxlength="2"> <input onkeypress="return EnterKeyHandler(this, event)" type="text" title="Game 2 - Ball 4" class="text_num" name="game2_mainball4" id="game2_mainball4" maxlength="2"> <input onkeypress="return EnterKeyHandler(this, event)" type="text" title="Game 2 - Ball 5" class="text_num" name="game2_mainball5" id="game2_mainball5" maxlength="2"> <span class="quickpick" style="display: inline;">
<strong>OR</strong>
<input type="button" name="quickpick" class="btn light" value="Quick Pick" onclick="QuickPick(2, 5, 0, 90, 0)">
</span>
<strong>Game Type</strong>
<input type="text" class="text_small" readonly="readonly" name="gametypeform2" value="Perm" maxlength="10">
</span>
<strong>At</strong>
<input onkeypress="return EnterKeyHandler(this, event)" type="text" title="price" class="text_small" name="game2_price" id="game2_price" maxlength="5" />
<br>
</div>