通过电子邮件发送 SQL 数组的提交表单
Emailing submitted form of a SQL array
~编辑
几天来我一直在处理同样的问题。我正在尝试更改从查询中提取的数组中的各个字段(维度),然后将结果通过电子邮件发送给自己。这是我目前所拥有的...
//form.php
echo "<table id='tableTop'>";
echo "<tr>";
echo "<th>Pick Ticket</th>";
echo "<th>Item ID</th>";
echo "<th>Bin</th>";
echo "<th>Length</th>";
echo "<th>Width</th>";
echo "<th>Height</th>";
echo "</tr>";
while($key = odbc_fetch_array($rows)){
echo "<form id='Email_Fix' method='post' action='mail.php'>";
echo "<tr>";
echo "<td><input type='text' name='PT_N' value=". $key['PT_N'] ." readonly></td>";
echo "<td><input type='text' name='Item_ID' value=". $key['Item_ID'] ." readonly></td>";
echo "<td><input type='text' name='Bin' value=". $key['Bin'] ." readonly></td>";
echo "<td><input type='tel' step='0.01' pattern='[0-9\.]*' name='Length' value=" . $key['Length'] . " size='10'></td>";
echo "<td><input type='tel' step='0.01' pattern='[0-9\.]*' name='Width' value=" . $key['Width'] . " size='10'></td>";
echo "<td><input type='tel' step='0.01' pattern='[0-9\.]*' name='Height' value=" . $key['Height'] . " size='10'></td>";
echo "</tr>";
echo "<tr>";
部分代码"name='"。 $key['PT_N'] ."_length' 是尝试动态更改输入字段名称的微弱尝试。我遇到的问题是,我需要能够在 mail.php 页面,但我还没有弄清楚如何通过 $_POST 引用每个页面...
//mail.php
foreach($_POST as $key => $value) {
echo "POST parameter '$key' has '$value'";
}
上面的代码帮助很大,但它只从 form.php 返回一行。这是我得到的输出......但是;这实际上有 20 行... "No trade secrets have been published" :P
POST parameter 'PT_N' has '4338892'POST parameter 'Item_ID' has
'KOHK-14484-BGD'POST parameter 'Bin' has 'BOXFIX01'POST parameter
'Length' has '3.000000000'POST parameter 'Width' has '2.500000000'POST
parameter 'Height' has '2.000000000'
~更新
我让它工作了,但是...我更进一步并创建了一个函数
$msg = "<p> Mike!</p><p> Here is your stuff!\n\n
<table id='tableTop'>
<tr>
<th>Pick Ticket</th>
<th>Item ID</th>
<th>Bin</th>
<th>Length</th>
<th>Width</th>
<th>Height</th>
</tr>";
function Fixit($loop, $num){
foreach($_POST[$loop] as $key => $num){
echo "<td>" . $num . "</td>";
};
};
$msg1 = " <tr>" . Fixit('PT_N', '0') && Fixit('Item_ID', '1') && Fixit('Bin', '2') && Fixit('Length', '3') && Fixit('Width', '4') && Fixit('Height', '5') ."</tr>";
echo $msg, $msg1;
这行不通?
你可以做到
foreach ($_POST as $key => $value) {
// $key = name of the input
// $value = value of the input
}
~编辑
几天来我一直在处理同样的问题。我正在尝试更改从查询中提取的数组中的各个字段(维度),然后将结果通过电子邮件发送给自己。这是我目前所拥有的...
//form.php
echo "<table id='tableTop'>";
echo "<tr>";
echo "<th>Pick Ticket</th>";
echo "<th>Item ID</th>";
echo "<th>Bin</th>";
echo "<th>Length</th>";
echo "<th>Width</th>";
echo "<th>Height</th>";
echo "</tr>";
while($key = odbc_fetch_array($rows)){
echo "<form id='Email_Fix' method='post' action='mail.php'>";
echo "<tr>";
echo "<td><input type='text' name='PT_N' value=". $key['PT_N'] ." readonly></td>";
echo "<td><input type='text' name='Item_ID' value=". $key['Item_ID'] ." readonly></td>";
echo "<td><input type='text' name='Bin' value=". $key['Bin'] ." readonly></td>";
echo "<td><input type='tel' step='0.01' pattern='[0-9\.]*' name='Length' value=" . $key['Length'] . " size='10'></td>";
echo "<td><input type='tel' step='0.01' pattern='[0-9\.]*' name='Width' value=" . $key['Width'] . " size='10'></td>";
echo "<td><input type='tel' step='0.01' pattern='[0-9\.]*' name='Height' value=" . $key['Height'] . " size='10'></td>";
echo "</tr>";
echo "<tr>";
部分代码"name='"。 $key['PT_N'] ."_length' 是尝试动态更改输入字段名称的微弱尝试。我遇到的问题是,我需要能够在 mail.php 页面,但我还没有弄清楚如何通过 $_POST 引用每个页面...
//mail.php
foreach($_POST as $key => $value) {
echo "POST parameter '$key' has '$value'";
}
上面的代码帮助很大,但它只从 form.php 返回一行。这是我得到的输出......但是;这实际上有 20 行... "No trade secrets have been published" :P
POST parameter 'PT_N' has '4338892'POST parameter 'Item_ID' has 'KOHK-14484-BGD'POST parameter 'Bin' has 'BOXFIX01'POST parameter 'Length' has '3.000000000'POST parameter 'Width' has '2.500000000'POST parameter 'Height' has '2.000000000'
~更新
我让它工作了,但是...我更进一步并创建了一个函数
$msg = "<p> Mike!</p><p> Here is your stuff!\n\n
<table id='tableTop'>
<tr>
<th>Pick Ticket</th>
<th>Item ID</th>
<th>Bin</th>
<th>Length</th>
<th>Width</th>
<th>Height</th>
</tr>";
function Fixit($loop, $num){
foreach($_POST[$loop] as $key => $num){
echo "<td>" . $num . "</td>";
};
};
$msg1 = " <tr>" . Fixit('PT_N', '0') && Fixit('Item_ID', '1') && Fixit('Bin', '2') && Fixit('Length', '3') && Fixit('Width', '4') && Fixit('Height', '5') ."</tr>";
echo $msg, $msg1;
这行不通?
你可以做到
foreach ($_POST as $key => $value) {
// $key = name of the input
// $value = value of the input
}