-4
<?php
            $srver = $_GET['S'];
            $fnum = $_GET['F'];
            if ($srver == '')($connect = odbc_connect('van' ,'user' , 'password'));
            if ($srver == '')   {$other_srvr = 'T' ; $other = 'Toronto';}
            if ($srver == 'V') ($connect = odbc_connect('van' ,'user' , 'password'));
            if ($srver == 'V')  {$other_srvr = 'T' ; $other = 'Toronto';}
            if ($srver == 'T') ($connect = odbc_connect("tor" ,"user" , "password"));
            if ($srver == 'T')  {$other_srvr = 'V' ; $other = 'Vancouver';}
            if ($fnum == '')    {$Fnumber = '&F=' ;}
            echo "<form method='post' action=$PHP_SELF> ";
            echo "<a href='mypage.php?S=$other_srvr$Fnumber'>Change Server to $other</a>" ;
            echo "<br>";
            echo "<strong> Filter Number : </strong><input name='F' type='text' size='20'>";
            echo" <input type='submit' name='submit' value='Search' />"; # Create submit button
            echo "</form>"; 
            $sum = array();
            if (isset($_POST['submit'])) 
                    {

                        $r = "1" ; 
                    }
            else
                    {                   

                    $query = Select abc from table;

                    }

                    odbc_close($connect);
?>

所以这是我的代码。问题是我如何让页面提交它只是刷新。有人可以解释一下吗?其次,我正在检查带有 if 语句的服务器,有没有办法在单行中做到这一点。我似乎无法找到它的工作。

谢谢

4

2 回答 2

1

首先,如果 $PHP_SELF 以某种方式起作用,它不在“”中。其次,您需要了解如何将 SQL 与 PHP 一起使用。可能是这样的?

$query = mysql_query("SELECT abc FROM table");
于 2012-08-17T23:50:37.553 回答
0

if ($srver == '')($connect =应该是if ($srver == ''){$connect =...等等,花括号等等。

于 2012-08-17T23:45:39.953 回答