2016-04-15 17 views
1

隠しデータとユーザー入力データを別のページに送信します。まず、1つのユーザー入力のみを作成しようとしたところ、システムは必要なだけデータを送信できました。別のページにデータを送信できません

<h1><strong>Please scan barcode on JIG</strong></h1> 
<table> 
<form action="productjit21.php" method="post" name="check2"/> 
<input type="hidden" name="productnumber" value="<?php echo $productnumber; ?>"> 
<tr><td>JIG Barcode</td><td>:</td><td><input type="text" name="jitcode2" maxlength="50"/></td></tr> 
</table> 

上記のコードでは、ユーザーと隠しデータを送信できます。しかし、ユーザー入力のために新しい行を追加すると、データを送信できません。

<h1><strong>Please scan barcode on JIG</strong></h1> 
<table> 
<form action="productjit21.php" method="post" name="check2"/> 
<input type="hidden" name="productnumber" value="<?php echo $productnumber; ?>"> 
<tr><td>JIG Barcode</td><td>:</td><td><input type="text" name="jitcode1" maxlength="50"/></td></tr> 
<tr><td>JIG Barcode</td><td>:</td><td><input type="text" name="jitcode2" maxlength="50"/></td></tr> 
</table> 

私はバーコードスキャナを使用したいので送信ボタンを作成しません。私は1つだけのユーザー入力を作成すると、システムは送信ボタンなしで実行できるので、送信ボタンは問題ではないと思います。代わりにformタグを閉じるの

答えて

1

はすぐにそう

<form action="productjit21.php" method="post" name="check2"> 
<input type="hidden" name="productnumber" value="<?php echo $productnumber; ?>"> 
<tr><td>JIG Barcode</td><td>:</td><td><input type="text" name="jitcode1" maxlength="50"/></td></tr> 
<tr><td>JIG Barcode</td><td>:</td><td><input type="text" name="jitcode2" maxlength="50"/></td></tr> 
</form> 
+0

おかげ@Ruben船井のようなフォームタグで入力をラップしてみてください。 私はあなたの提案を試みました。それでもデータを送信することはできません。「入力」をクリックすると何も起こりません。 –

+1

2つの入力フィールドがあるので、送信をトリガーするには送信ボタンが必要です。あなたのテーブルに別の行を追加するには、隠されたボタンをクリックしてください。 ' –

+1

この小さな「quirk」についての記事を見ることができます。http://stackoverflow.com/questions/1370021/why-does-forms-with-single -input-field-submit-enter-enter-enter-key-in-input –

関連する問題