Hi everybody,
I'm new in PHP coding a I want to wrote php script, which find some data in database. But it doesn't work.When I submit form to search, it's write an error:
Connection not avaliable!
Error 403!
localhost
05/27/09 22:33:46
Apache/2.2.11 (Win32) PHP/5.2.8
Could somebody help me?
<?php
error_reporting (E_ALL ^ E_NOTICE);
ini_set("display_errors",1);
include('incl/str.php');
require_once('incl/header.php');
$title = $str["student_search"];
?>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN''http://www.w3.org/TR/html4/strict.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php print('EDUKID - $title'); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel='stylesheet' type='text/css' href='../css/edukid_default.css'>
<STYLE>
#but1 {width: 200px;}
</STYLE>
</head>
<body>
<IMG id="lupa" src="../img/lupa.png" alt="lupa">
<H1 class="student_search_nadpis">Vyhladavanie ziakov</H1>
<form method="post" action='".$_SERVER["PHP_SELF"]."?action=hladaj'>
<table>
<tr>
<th class="odstavec1">Meno: </th>
<th class="odstavec1">Rocnik: </th>
<th class="odstavec1">Predmet: </th>
<th class="odstavec1">Zoznam vsetkych ziakov: </th>
</tr>
<tr>
<td class="odstavec2" width='6' ><input type="text" name="meno"></td>
<td class="odstavec2" width='6' nowrap="nowrap" ><select name="rocnik"><option value="1">Prvy</option>
<option value="2">Druhy</option>
<option value="3">Treti</option>
<option value="4">Stvrty</option></select><br /></td>
<td class="odstavec2" width='6' nowrap="nowrap"><select name="predmet"><option value="Matematika">Matematika</option></select></td>
</tr>
</table>
<center><input class="hladaj" id="but1" type="submit" value="Hladaj"></center>
<hr />
<h3 align="center">Vysledky Vyhladavania</h3>
<table>
<tr>
<th class="odstavec3">Meno: </th>
<th class="odstavec3">Predmet: </th>
<th class="odstavec3">Rocnik: </th>
</tr>
<tr>
<td class="odstavec2" width='6' nowrap="nowrap"><input type="checkbox" value="ziak" name="ziak"></td>
</tr>
</table>
<hr />
<h3 align="center">Akcie</h3>
<table>
<tr>
<td class="odstavec4" >Zapisat predmet: </td>
<td class="odstavec4" width='6' nowrap="nowrap" ><select name="predmet"><option value="matematika">Matematika</option></select>
</tr>
<tr>
<td class="odstavec4" >Odpisat predmet: </td>
<td class="odstavec4" width='6' nowrap="nowrap" ><select name="predmet"><option value="matematika">Matematika</option></select>
</tr>
<tr><td><input class="hladaj" id="but1" type="submit" value="Presun do dalsieho rocnika"></td></tr>
<tr><td><input class="hladaj" id="but1" type="submit" value="Ukoncit studium"></td></tr>
</table>
</form>
<?php
if ($_GET['action']=='hladaj'){
$meno = $_POST["meno"];
//$rocnik=$_POST[["rocnik"];
//$predmet=$_POST["predmet"];
$query="SELECT * usr_name FROM usr WHERE meno = '" . $meno . "'";
$result=mysql_query($query) or die ("Chyba mysql prikazu");
if(mysql_num_rows($result) == null){
//header("Location:index.php");
exit;
}
$line=mysql_fetch_array($result);
echo $result['name'];
echo "<br>";
}
@mysql_close($connect);
?>
</body>
</html>