Ich habe ein Problem mit meinem PHP. In meinem Code zeigt es, dass der Text <?php if (!empty()) { echo ; } ?>
im Wert des Textfelds angezeigt wird, wenn ich das Skript ausführe. Ich möchte den Text in dem Wert nicht entfernen, da ich sie beim Öffnen des Popups verwenden muss, um die Liste der Zeichenfolgen aus der Variablen $email_str
einzugeben, damit ich die Liste der Zeichenfolgen in der Textbox ausgeben kann. HierWie blende ich den Text im Textboxwert aus?
ist der Code:
<?php
include('config.php');
if($_GET['id'] != '')
{
$id = $_GET['id'];
$readDateTime = date("Y-m-d h:i:s");
mysql_query("update tracker set isRead='1', readDateTime='$readDateTime' where id='$id'");
header('Location: http://robsite.com/phpmailer/examples/blank.jpg');
exit;
}
else
{
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Send Email</title>
<link type='text/css' rel='stylesheet' href='style.css' />
<script src='jquery-1.12.0.js'></script>
<script>
$(document).ready(function(){
$('#popup').click(function(event) {
event.preventDefault();
var popup = window.open('add_address.php', '_blank', 'toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=500, width=400, height=400');
if (popup != null && !popup.closed) {
var element = popup.document.getElementById('thePopupField');
var text = $('#theField').val();
if(text != ''){
var count = (text.match(/,/g) || []).length;
popup.my_count = count+1;
popup.my_special_setting = text.replace(/,/g, '\n');
}
}
});
});
</script>
</head>
<body>
<!---->
<form action='pr_send.php' method='POST' id='theForm'>
<table>
<!-- <tr>
<td>From:</td>
<td><input type='text' name='from'></td>
</tr> -->
<tr>
<td><input type='button' name='to' value='' style='height:24px; width:24px; background: url(\"addressbook.png\"); border:none;' id='popup' > To:</td> <!--onClick='Popup()'-->
<td><input type='text' id='theField' name='to' value='<?php if (!empty($email_str)) { echo $email_str; } ?>' style='height:15px; width:650px'> (<span id='noOfEmails'>0</span>)</td>
</tr>
<tr>
<td>Subject:</td>
<td><input type='text' name='subject' style='height:15px; width:650px'></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name='message' cols='90' rows='20'></textarea></td>
</tr>
<tr>
<td colspan='2' align='left'>
<input type='submit' name='send' value='' style='height:35px; width:100px; background: url(\"send.png\"); border:none'>
</td>
</tr>
</table>
</form>
</body>
<!--<script type='text/javascript'>
var popup = null;
function Popup()
{
window.open('add_address.php', '_blank', 'toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=500, width=400, height=400');
}
function closePopUp()
{
if (popup)
{
popup.close();
}
}
</script>-->
</html>";
}
if (!empty($_POST['message']))
{
$emails = explode("\n", $_POST['message']); // explode textarea on a line break into an array
$email_str = implode(", ", $emails); // take each of the emails and implode together with the ,
echo '<script> closePopUp(); </script>'; //call javascript function
}
?>
Wenn ich den Code in HTML lief, es funktioniert gut, wie der Text nicht in der Textbox zeigte.
Wie kann ich den Text in den Wert ausblenden, wenn ich den HTML-Code in PHP ausführen?
konnte man u se input type hidden – rtfm
@rtfm Es tut mir leid, aber ich kann nicht den Eingabe-Typ ausgeblendet, weil ich die Texteingabe verwende, wie ich die Textbox sehen möchte, wenn ich das Skript ausführen. –