我对 php 编程很陌生,但我试图将值从 multislect 对象 im html 传递给 PHP 中的一些代码,然后这些代码将通过电子邮件发送给列出的人
然而,通过帖子传递的变量似乎只是最后一个选择的项目
你如何将某些东西作为数组传递?
html代码:
<li id="li_6" >
<label class="description" for="Names[]">Employees who should be added to this charge code: (Hold CTRL to Multi Select)</label>
Malav, Nancy, Filiz, CJ are added by default and not on the list
<div>
<select name="Names" multiple>
<option value="gbiy@afsafd.com">Bi,Gilbert</option>
<option value="jbster@asdfasds.com">Bor,Jeff</option>
<option value="ibett@adfasdfions.com">Bt,Ivan</option>
<option value="scelos@agasdgasdns.com">Caos,Sheryl</option>
<option value="rcarsfsfdgy@madfasdfs.com">Car,Raymond</option>
<option value="dcaraahers@asdfasdftions.com">Cs,Dale</option>
<option value="Cclesfdgsdents@mabukhyns.com">Cles,Cathy</option>
<option value="lcugh@madsfadsfasds.com">Cl,Lori</option>
<option value="rcolns@madsfasdfons.com">Cons,Renee</option>
<option value="ccrine@maasdfkoadsfasd.com">ine,Cassandra</option>
<option value="pcrett@maadsfasdfons.com">Ctt,Pamela</option>
</select>
</div>
</li>
php代码:
<?php
// Read POST request params into global vars
$from = "BP@fgsdfgsons.com";
$title = $_POST[Title] ;
$mname = $_POST[ManagerName];
$memail = $_POST[ManagerEmail];
**$names= $_POST['Names']; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<**
$other = $_POST[element_4];
print $email;
$to = "sfgsdfg@sdfgsdfgssbd.com" + $memail;
$message ="Title: $title \r\nManager: $mname\r\nManager email: $memail\r\n" ;
$headers = "From: $from";
$today = date("m/d/Y");
$ok = @mail($to, $subject, $message, $headers);
echo "Your email has been sent! Please confirm with Malav if you do not receive a confrimation email in 2 hours";
?>