Hallo, wie kann ich eine Datei öffnen, in der eine Datenbankabfrage habe und das Ergebnis wieder an die Hauptseite zurückgegeben wird, eventuell soll auf der Hauptseite eine function Befehl durchgeführt werden.
Danke
Danke
/** * Diese JS Funktion wird im Hauptfenster defiiert. */ function hauptfenster_empfangeDaten( daten ) { // Hier die Daten weiter verwursten } /** * Diese JS Funktion wird im Unterfenster defiiert. */ function unterfenster_sendeDatenAnHauptfenster() { // Dynamisch den Wert aus PHP setzen (Beispiel mit Smarty) var daten = '{$daten|escape:'quotes'}'; // An Hauptfensterfunktion senden window.opener.hauptfenster_empfangeDaten( daten ); }
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- HTML 4.x -->
<meta charset="utf-8">
<!-- HTML5 -->
<?php
header("Content-Type: text/html; charset=utf-8");
?>
<title>Nachrichten</title>
<style>
body {
font-family: Verdana, Arial, Sans-Serif;
}
a:link, a:visited {
color: Royalblue;
text-decoration: None;
}
</style>
</head>
<script language="javascript" type="text/javascript">
function CallParentWindowFunction()
{
window.opener.ParentWindowFunction( a );
return false;
}
</script>
<body>
<h1> klappt? </h1>
<?php
include("db.log.php");
$aa = "";
$annotation_data = mysql_query("SELECT DATE_FORMAT(xval,'%Y/%m/%d %H:%i:%s') AS xval1, xval, series, shortText, text
FROM ".$database_anno." ORDER BY xval ") or die(mysql_error());
while($row = mysql_fetch_array($annotation_data))
{
$text = str_replace("\r\n", "<br>", $row['text']); // eingebaute Umbrüche ausbessern
$aaa = " " .$aaa. "{series: '".$row[series]."', x: Date.parse('".$row[xval1]."'), shortText: '".$row[shortText]."', text: '" .$text."'}," ;
}
//echo $aaa;
?>
<script language="javascript" type="text/javascript">
var a = "<?php echo $aaa ?>" ;
//alert (a);
CallParentWindowFunction();
//window.close();
</script>
</body>
</html>
function ParentWindowFunction(a) {
var anns = a;
alert (anns);
var a = "abc";
<?php $variable = $_POST["a"]; ?>
//$Inhalt = $_POST["Inhalt"];
var ab = "<?php echo $variable ?>" ;
alert (ab);
graphdiv2.setAnnotations(anns); // Annotations anzeigen
//alert(anno);
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- HTML 4.x -->
<meta charset="utf-8">
<!-- HTML5 -->
<?php
header("Content-Type: text/html; charset=utf-8");
?>
function CallParentWindowFunction()
{
window.opener.ParentWindowFunction( a );
return false;
}
function callParentWindowFunction( data ) { window.opener.ParentWindowFunction( data ); return false; }
<script language="javascript" type="text/javascript">
callParentWindowFunction( <?php echo json_encode( $aaa ); ?> );
function ParentWindowFunction(a) {
var anns = a;
alert (anns);
var a = "abc";
body {
font-family: Verdana, Arial, Sans-Serif;
}
a:link, a:visited {
color: Royalblue;
text-decoration: None;
}
</style>
</head>
<script type="text/javascript">
function callParentWindowFunction()
{
window.opener.parentWindowFunction( dataphp );
return false;
}
</script>
<body>
<h1> klappt? </h1>
<?php
include("db.log.php");
$aa = "";
$annotation_data = mysql_query("SELECT DATE_FORMAT(xval,'%Y/%m/%d %H:%i:%s') AS xval1, xval, series, shortText, text
FROM ".$database_anno." ORDER BY xval ") or die(mysql_error());
while($row = mysql_fetch_array($annotation_data))
{
$text = str_replace("\r\n", "<br>", $row['text']); // eingebaute Umbrüche ausbessern
$annos = " " .$annos. "{series: '".$row[series]."', x: Date.parse('".$row[xval1]."'), shortText: '".$row[shortText]."', text: '" .$text."'}," ;
}
// echo $annos;
?>
<script type="text/javascript">
<?php echo $annos ; ?>
var dataphp = " <?php echo json_encode( $annos ); ?>" ;
alert (dataphp);
callParentWindowFunction( );
alert (dataphp);
//window.close();
</script>
</body>
</html>
function parentWindowFunction(dataphp) {
var data2 = "["+dataphp+"]";
alert (data2);
graphdiv2.setAnnotations(data2); // Annotations anzeigen
//alert(anno);
}
var dataphp = " <?php echo json_encode( $annos ); ?>" ;
alert (dataphp);
graphdiv2.setAnnotations(anns);
graphdiv2.setAnnotations([<?php echo $aaa ?>]);
graphdiv2.setAnnotations([<?php echo $aaa ?>]);
Kommentar