<?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);
?>
So this is my code. The problem is how do i get the page to submit it just refreshes. Can someone please explain and secondly i am checking for server with if statements on top, is there to way to do that in single line. I cant seem to find it to work.
Thanks
if ($srver == '')($connect =
should be if ($srver == ''){$connect =...
and so on, curly braces and whatnot.
First off, if $PHP_SELF somehow worked, it's not in "". Second, you need to look up how use SQL with PHP. Something like this maybe?
$query = mysql_query("SELECT abc FROM table");