结果在新窗口中 - PHP + HTML

时间:2015-02-16 14:28:08

标签: php html mysql

我需要将结果显示在新窗口中。这是我的代码。我应该做些什么改变才能在新窗口中获得结果。我尝试使用onclick(window.open()),但我不确定我的目标网址是什么。在这方面请帮助我。

<style type="te<td>xt/css">
.style29 tr tbody tr td p strong {
font-family: "Courier New", Courier, monospace;
}
</style>

<TABLE class=style29 cellSpacing=0 cellPadding=0 width=600
            bgColor=#fdf7f2 border=0 align = "center">
              <TR>

       <form name="MicRooN">
<tr> <td align ="center" bgcolor = #f6cece> <h1><big><big><strong><B style = "COLOR:#FF0000">Mi</B>c<B style = "COLOR:#FF0000">R</B>oo<B style = "COLOR:#FF0000">N</B>&nbsp;</strong></big></big></h1>
</td>
<! this is for the about the tool >
<tr >
<td >
<!--
<fieldset><legend><B>About the Tool</B></legend>
MicRooN (an acronym of miRNA), a tool for identification of miRs associated with cancer. Its a ensemble based classifier[LIBSVM,C4.5 & Random Forest], built on experiementally validated set of miRs associated with cancer. The tool aims in identifying novel miR associated in cancer pathway.
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-->

<br></fieldset>
<! this is for the Input>
<tr>
<td><fieldset><legend><B>Input</B></legend>
<p align = "center">
<form method = "post" action="/">
    <center>Input miR ID :<input name = "miRNA" id ="textfeild" type = "text" placeholder="hsa-mir-532-3p" /></p>
    Input Target :<input name = "target" id ="textfeild" type = "text" placeholder="RCN2" /></p></center>
    <p align="center"> <input id="Submit" value="Submit" type="submit" /> 

    </form>

    <button onclick="window.location.assign('http:\\')" />Clear</button>
    <br><br>
<p style="text-align: center;">Format for miR ID :
hsa-mir-6793&nbsp;<br />
(As per <A href  = "http://www.mirbase.org">miRBASE </A>format)</p>
 </fieldset>  </td>
</tr>
<! this is for the output>



<?php
if (isset($_REQUEST["miRNA"])){
    $dummy = true;
}
else{
    goto foot;
}
?>


<tr>
<td align="center" ><fieldset><legend>Output</legend><br>
<style>
#output tr td{
    border:1px solid black;
}
.bold{
    font-size:18px;
    text-decoration:bold;
}
</style>
<table id="output" style="border:1px solid black;">
    <tr class="bold">
        <td>EnsembleID</td>
        <td>Target</td>
        <td>Gene Length</td>
        <td>miRNA</td>
        <td>miRNA Length</td>
        <td>mfe</td>
        <td>P-value</td>
        <td>Position</td>
        <td>Prediction</td>
        <td>No of Seeds</td>
    </tr>
    <?php
        $a = $_REQUEST["miRNA"];
        $b = $_REQUEST["target"];
        // $result = db::table("`table`") -> pluck("*") -> where("miRNA",$a) -> select() -> get();
        $mysqli = new mysqli("localhost", "root", "password", "mysql");
        $a = $mysqli -> escape_string($a);
        $b = $mysqli -> escape_string($b);
        $a = $mysqli->query("SELECT * FROM `bio2` where miRNA = '$a' and Target like '%$b' ORDER BY  `bio2`.`pvalue` ASC;");
        // $result = $a -> fetch_assoc();
        $i = 0;
        while ($row = $a -> fetch_assoc()) {
            $result[$i] = $row;
            $i++;

        }
        $mysqli->close();
        for($a=0;$a<sizeof($result);$a++){
            print '<tr>
                    <td>'.htmlentities($result[$a]["Ensemble_ID"]).'</td>
                    <td>'.htmlentities($result[$a]["Target"]).'</td>
                    <td>'.htmlentities($result[$a]["Gene_Length"]).'</td>
                    <td>'.htmlentities($result[$a]["miRNA"]).'</td>
                    <td>'.htmlentities($result[$a]["miRNA_Length"]).'</td>
                    <td>'.htmlentities($result[$a]["mfe"]).'</td>
                    <td>'.htmlentities($result[$a]["pvalue"]).'</td>
                    <td>'.htmlentities($result[$a]["position"]).'</td>
                    <td>'.htmlentities($result[$a]["Prediction"]).'</td>
                    <td>'.htmlentities($result[$a]["no_of_seeds"]).'</td>
                </tr>';
        }
    ?>
</table>
<style type="text/css">
    table{
        text-align: center;
    }
    td{
        min-width: 100px;
    }
</style>
<?php
if(sizeof($result) == 0){
    print "<h3 style='color:red;'>miRNA record not found</h3>";
}
?>
<br><br></fieldset> </td>
</tr>

<?php

foot:
?>

<! this is for the reference>
<tr>
<td>
<fieldset><legend><B>Reference</B></legend>
<ul>
<li> "Search for signatures in miRNAs associated with cancer", Kothandan R, Biswas S, Bioinformation, Vol.9(10) <A href = "http://www.ncbi.nlm.nih.gov/pubmed/?term=23861569"><B> [PMID:23861569] </B></A> </li>
<li> "Sequence Trademarks in oncogene associated microRNAs", Sharma S, Biswas S, Bioinformation, Vol.6(9) <A href = "http://www.ncbi.nlm.nih.gov/pubmed/?term=21814397"><B> [PMID:21814397] </B></A> </li>
</ul>
<br></fieldset>
</td>
</tr>
</table>
<footer align = "center"> &#169 Vista Lab Copyright 2013-2014, Sumit Biswas & Ram K. All righs reserved. | Disclaimer </footer>
<?php
$x = file_get_contents("./view/counter");
file_put_contents("./view/counter", $x+1);
print "<center>page view = $x<br>";
$ip = $_SERVER["REMOTE_ADDR"];
print "you ip is".$_SERVER["REMOTE_ADDR"]."</center>";
file_get_contents("./view/ip");
$str = "Access from ".$ip."\n";
$log = file_get_contents("./view/ip");
$log = $log.$str;
file_put_contents("./view/ip", $log);
?>

2 个答案:

答案 0 :(得分:1)

查看属性目标:

<form action="/result.php" method="post" target="_blank">

答案 1 :(得分:0)

创建新页面(http页面),以便在新窗口下显示所需的功能。并在单击窗口代码中指向新创建的页面URL。

或者你可以使用原生的javascript在窗口中写你的内容。 例如:

<强> HTML

<button onclick="myFunction()">Try it</button>

<强>的Javascript

<script>
function myFunction() {
    var myWindow = window.open("", "MsgWindow", "width=200, height=100");
    myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");
}
</script>

你可以注意到myfunction函数完成了几项任务,首先它将生成新的窗口对象,然后我们在新创建的窗口对象下编写一些东西,然后成功激活它。

通过这种方法,我们不需要担心url会被击中。