0
我對PHP很有經驗,只是一些基本的理解,而且我試圖通過post方法將MySQL查詢的結果發送到特定的URL。如果我是在一個表中的網頁上顯示,然後連接信息後,我會......發送mysql查詢結果通過php post函數
$result = mysql_query("select Selection, Date, Name from selectiontable order by Date");
echo "<table border='1'>
<tr>
<th>Selection</th>
<th>Race</th>
<th>Name</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Selection'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "</tr>";
}
echo "</table>";
除了打印到表我想通過郵政將此信息發送到一個URL。我搜索了高和低,似乎只能找到有關如何發送通過表單輸入信息的信息。該查詢產生大約200行。有人向我發送了下面的腳本來適應,但我無法弄清楚如何將查詢結果放入其中。
<?php
$entries=(isset($_GET['entries']) ? $_GET['entries'] : '1');
echo '<h2>Send</h2>';
echo '<style> .over{clear:both; margin:5px; border:1px solid #ccc; padding:10px;} label{display:block;} input {display:block; margin:5px 0 0 0;}</style>';
echo'<form method="post" action="http://www.domain.com" id="" name="">';
for ($i=0; $i < $entries; $i++) {
echo '
<div class="over">
<div class="proof_type">
<label for="selection_'.$i.'">Selection</label>
<input name="selection_'.$i.'" value="" type="text" >
</div>
<div class="proof_type">
<label for="date_'.$i.'">Date</label>
<input name="date_'.$i.'" value="" type="text" >
</div>
<div class="proof_type">
<label for="name_'.$i.'">Name</label>
<input name="name_'.$i.'" value="" type="text" >
</div>
</div>
';
}
echo '<input type="hidden" name="action" value="insert" />';
echo'<input type="submit" name="submit" value="submit" class="button" />';
echo'</form>';
?>
我會非常感謝任何幫助。謝謝。
[**請不要在新代碼中使用'mysql_ *'函數**](http://bit.ly/phpmsql)。他們不再被維護[並且被正式棄用](http://j.mp/XqV7Lp)。看到[**紅框**](http://j.mp/Te9zIL)?學習[*準備的語句*](http://j.mp/T9hLWi),並使用[PDO](http://php.net/pdo)或[MySQLi](http://php.net/ mysqli) - [這篇文章](http://j.mp/QEx8IB)將幫助你決定哪個。 – Kermit 2013-02-23 18:00:10
您無法發送郵件數據但不包含表格(儘管有阿賈克斯調用)。 – 2013-02-23 18:01:02