電子メール テンプレートの生成に使用されているフォームがあります。ページの下部には、電子メール名と、それを使用するためのアクセス権を持つ部門を表示する表があります。最終的に私がやりたいことは、ページの下部にある電子メールの名前をボタンのように機能させることです。ユーザーがメール名をクリックすると、DB からそれらの値が取得され、適切な入力フィールドに渡されます。以下は、現在の PHP コードのサンプルです。誰かが提案や例を提供できれば、私は感謝しています.
これは、電子メール テンプレートのセットアップ用のフォームです。
<form id="Email" name="Email" method='post' action="<?php echo htmlspecialchars($_SERVER['PHP']);?>">
<fieldset style="width: auto; height: auto;">
<legend class="legend1"><h2> Manage E-Mails </h2></legend>
<table width="100%" style="text-align:center">
<tr>
<td width="60%" style="text-align: left;">
<input type="text" id="name" name="name" placeholder="Email Template Name" value="" maxlength="100" style="width: 250px; height: 20px;"/>
<input type="radio" name="from" id="from" value="user" />Send From User
</td>
</tr>
<tr>
<td style="text-align: left;">
<input type="text" style="width:250px; height: 20px; visibility: hidden;" />
<input type="radio" name="from" id="from" value="department" />Send From Department
</td>
</tr>
<tr>
<td style="text-align: left;">
<input type="text" id="To" name="To" placeholder="To: " value="" maxlength="250" style="width: 250px; height: 20px;"/>
<input type="checkbox" name="user" id="user" value="YES" />Autocopy User
<?php echo "         ";?><input type = "checkbox" name="escalate" id="escalate" value="YES" />Make Escalated Email Only
</td>
</tr>
<tr>
<td style="text-align: left;">
<input type="text" id="CC" name="CC" placeholder="CC: " value="" maxlength="100" style="width: 250px; height: 20px;"/>
<input type="checkbox" name="customer" id="customer" value="YES" />Autocopy Customer
</td>
</tr>
<tr>
<td style="text-align: left;">
<input type="text" id="BCC" name="BCC" placeholder="BCC: " value="" maxlength="100" style="width: 250px; height: 20px;"/>
<input type="checkbox" name="additional" id="additional" value="YES" />Allow Additional Email Address(es)
</td>
</tr>
<tr>
<td colspan=2 style="text-align: left;">
<input type="text" id="subject" name="subject" placeholder="Subject " value="" maxlength="100" style="width: 400px; height: 20px;"/>
<a href="#" onclick="window.open('includes/adminpages/keywords.php', 'newwindow', 'width=500, height=400'); return false;">Keywords</a>
</td>
</tr>
<tr>
<td style="text-align: left;">
<textarea name="content" maxlength="3000" cols="100" rows="12"></textarea>
</td>
</tr>
</table>
<input type="submit" name="submit" value="Submit" style="float: left;">
</fieldset>
</form>
これは、ユーザーが電子メールが属する部門を更新できるようにするフォームです。ここにメール名が表示されます。メール名をクリックできるようにして、上の表に情報を生成したいと考えています。
<form id = "Display_Email" name="Display_Email" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP']);?>">
<?php
$get_business = mysql_query("SELECT bus_name, bus_id FROM business where bus_id = '{$_SESSION['bus_id']}'");
while(($business = mysql_fetch_assoc($get_business)))
{
echo '
<h3>'.$business['bus_name'].'</h3>
<table class="departments">
<tr>
<th scope="col" style="width: 175px;">Email Name</th>
';
$get_depts = mysql_query("SELECT dept_name FROM depts where bus_id = '{$_SESSION['bus_id']}'");
while(($department = mysql_fetch_assoc($get_depts)))
{
echo '
<th scope="col" style="width: 175px;">'.$department['dept_name'].'</th>
';
}
echo '
</tr>
';
$get_emails = mysql_query("SELECT id, email_name from emails where bus_id = '{$_SESSION['bus_id']}' ORDER BY email_name ASC");
while(($email = mysql_fetch_assoc($get_emails)))
{
echo '
<tr>
<td>'.$email['email_name'].'</td>
';
$get_depts = mysql_query("SELECT dept_name, dept_id FROM depts where bus_id = '{$_SESSION['bus_id']}'");
while(($department = mysql_fetch_assoc($get_depts)))
{
$get_email_dept = mysql_query("SELECT dept_id from emails where id = '{$email['id']}'");
while(($email_dept = mysql_fetch_assoc($get_email_dept)))
{
$departments = explode(",", $email_dept['dept_id']);
if(in_array($department['dept_id'], $departments, TRUE))
{
echo '<input type="hidden" name="Email_Box[]" value="0">';
echo '<td><input type="checkbox" name="Email_Box[]" value="'.$department['dept_id'].'" checked="checked""></td>';
}
else
{
echo '<input type="hidden" name="Email_Box[]" value="0">';
echo '<td><input type="checkbox" name="Email_Box[]" value="'.$department['dept_id'].'"></td>';
}
}
}
echo '
</tr>
';
}
echo '
</table>
';
}
?>
<input type="submit" name="Email_Submit" value="Submit" style="float: left;"/>
</form>